Saving Windows XP "My Network Places" to a Text File

I like the "My Network Places" functionality in Windows XP. The way I use Windows Explorer is to have mapped drives for high-use locations. "My Network Places" becomes a psuedo-"favourites" - linking to, for example, a folder where a third-party extract is dropped, or a shared folder from another department, or a folder used for backups but rarely accessed.

With that in mind I thought it would be handy to keep a copy of the UNC paths contained in "Network Places". There's a few tools that will allow you to print folder contents ("Network Places" is stored in the "NetHood" folder in your user profile) but that only resulted in the names, not the UNC paths.

Here's the VBScript I ended up cobbling together to save "My Network Places" to a text file, enumerating each item and getting the name as well as the UNC path. I hope this helps if, like me, you've ever considered just taking a screenshot of Windows Explorer to keep track of your network places:

Special Note: This works perfectly on my PC, however I can't take any responsibility for it working anywhere else. It's just a quick script that did the job for me, not a fully debugged application.

' ------------------------------------------------------------------------------
' Writes all folders/links in "My Network Places" on Windows XP to a text file
' Thomas Williams 13-May-2010

' adapted from and
' and
' ------------------------------------------------------------------------------

Const NETHOOD = &H13&

Set objShell = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")

' file to write to (overwrite without prompting)
Set outputFile = objFSO.CreateTextFile("C:\Network Places List.txt", True)

' get the NetHood folder on Windows XP for the current logged in user
Set objFolder = objShell.Namespace(NETHOOD)

' loop through all items in NetHood folder
For Each objItem in objFolder.Items
    ' if the item is a link e.g. not "Entire Network"
   If objItem.IsLink Then
        ' get the link/shortcut for the item
       Set objLink = objItem.GetLink
        ' write to the output file, the display name of the folder, and the UNC path
       outputFile.WriteLine(objItem.Name & vbTab & objLink.Path)
    End If

' close the output file

The tricky part was dealing with the list of items returned by Shell.Namespace and finding out how to get the link properties from a FolderItem...luckily I'm on first-name speaking terms with my friend the MSDN Library :-)

Tags: ,

posted @ Thursday, May 13, 2010 12:52 PM

Comments have been closed on this topic.