Nethood IconI 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:

image

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:

  1. desktop.ini
  2. target.lnk

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:

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:

image

But there is two more ingredients missing for Explorer to show the folder as a Nethood entry:

  • The folder needs to have the Read-only Attribute.
  • The file desktop.ini needs to have the Hidden Attribute.

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: