Have I done this right? - VB Script
Starting with the wonderfully useful script provided on edugeek's wiki, I've tried to change it to only reset home folder ownership, as NTFS permissions are fine & changing them without any reason scares me.
Here is my attempt:
Set FSO = CreateObject("Scripting.FileSystemObject")
Set ObjShell = Wscript.CreateObject("Wscript.Shell")
ShowSubfolders FSO.GetFolder("I:\path to folder containing home holders")
For Each Subfolder in Folder.SubFolders
WScript.Echo "Folder = " & Subfolder
userName = SubFolder.Name
CMDLine2 = "chown -r " & userName & " """ & Subfolder & "\*.*"""
WScript.Echo "Running CHOWN..."
Would someone with a better understanding of VB than me see if I have made a stupid mistake!?