Usage:

  • Download the script and save it to your desktop.
  • Using Windows Explorer, navigate to the folder containing the users "My Documents" folders you want to 'fix'.
  • Select the "My Documents" folders you want to fix (use CTRL and SHIFT to multi-select).
  • Drag and drop them onto the script.

Download

Script

Rem **********************************************
Rem Script Name: CC4-MyDocuments-FIX.vbs
Rem Purpose: Script to locate and remove Windows "DESKTOP.INI" files
Rem from home folders with a large number of uses (ie. curriculum)

Rem RMCC4 intermittently lists ALL users folders as "My Documents"
Rem when browsing the root share of users. This makes it difficult to
Rem navigate to users individual 'Home' folders as you will only see
Rem a list of "My Documents" folders - no identifying folder names.

Rem This does re-occur and this fix should be ran as part of your
Rem 'house-keeping' issues at the site.

Rem Usage: Save the script to your server desktop and drag'n'drop user home
Rem folders onto it. The script will delete any hidden "DESKTOP.INI"
Rem files and report as appropriate.

Rem ** Use with Caution - Test on a SINGLE home folder first**

Rem Written By: John Fermor
Rem Last Modified 09-Oct-12
Rem Version: 1.0.0
Rem Disclaimer: This script or software is
Rem provided as-is and the author cannot make
Rem any guarantee to its effectiveness.
Rem **********************************************

Set objArgs = WScript.Arguments

if WScript.Arguments.Count = 0 then

msgbox "Drag 1 or More 'Home' Folders onto the Script.", 16 ,"Folder(s) Not Specified!"

else

' Initialise
' ----------
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")

' Parse through EACH Folder, Removing the DESKTOP.INI file from Each User 'HOME' Folder
' -------------------------------------------------------------------------------------
dim objFolder, RetVal, wshShell
set wshShell = wscript.CreateObject("WScript.shell")

For I = 0 to objArgs.Count - 1
Set objFolder = fso.GetFolder(objArgs(I))
if fso.fileexists(objFolder.Path & "DESKTOP.INI") then
retVal = fso.DeleteFile(objFolder.Path & "DESKTOP.INI")
if retval > 0 then msgbox "Error Deleting File: " & objFolder.path, 0, "Error " & retVal
end if
Next

' Clean Up
' --------
set objFolder = nothing
set fso = nothing
set wshShell = nothing

' Complete!
' ---------
msgbox I & " User Folder(s) Processed. Pleae wait a few minutes for the changes to apply.", 64, "Complete!"

end if

Points to Note

You must wait for the message box to confirm the process has finished and it may take some time if you're processing a large number of folders.

Test on a single folder and check the outcome BEFORE you drag and drop multiple users onto the script.

Absolutely no warrantee is implied - use at your own risk!