$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like
I am using a PowerShell script to copy some elements of from the users old profile location to a new location. This includes the Nethood ("My Network Places") folder which contains the Network Places shortcuts.
A user reported that she could not save documents to Network Places anymore and after inspection the Network Places shortcuts were broken.
I started comparing the old Nethood folder to the new and observed the following difference in Explorer:
When copying entries from the Nethood folder with Explorer manually they worked fine, so somehow Explorer gives the Nethood folder special treatment.
When you browse the Nethood folder from a command prompt or a tool like Total Commander you can see that an entry in Nethood is really a folder containing 2 files:
Desktop.ini is a hidden file that instructs Explorer how to display a folder and in the case of a Nethood entry it’s always the same:
1 2 3 | [.ShellClassInfo] CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D} Flags=2 |
The Guid {0AFACED1-E828-11D1-9187-B532F1E9575D} belongs to "Folder Shortcut" and indeed the shortcut in target.lnk is a shortcut to a folder.
If we inspect target.lnk we can see that’s in indeed a shortcut to a (shared) folder:
But there is two more ingredients missing for Explorer to show the folder as a Nethood entry:
And this is exactly what went wrong in the PowerShell filecopy: the Read-only attribute wasn’t copied along!
I wrote a Fixup function in PowerShell:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function FixUpNethood([string]$path) { try { foreach ($item in (gci $path -ErrorAction:Stop)) { $item.Attributes = [System.IO.FileAttributes]::ReadOnly $ini = gci (Join-path -Path $item.FullName -ChildPath 'desktop.ini') -Force $ini.attributes = [System.IO.FileAttributes]::System -bor [System.IO.FileAttributes]::Hidden } } catch { # ignore errors } } |
2 Responses for "My Network Places Internals"
[…] PS: desktop.ini is a versatile file that’s used for many different purposes, for instance the Nethood or My Network Places as described by Remko Weijnen. […]
Rather than ignoring the errors, it’s quite easy to write to the Windows event log with “write-eventlog”. You never know who might end up supporting the environment that you build.
Leave a reply