Windows Thread, Have I done this right? - VB Script in Technical; Starting with the wonderfully useful script provided on edugeek's wiki, I've tried to change it to only reset home folder ...
22nd September 2010, 11:48 AM #1
- Rep Power
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!?
22nd September 2010, 12:29 PM #2
The only thing that stands out as wrong to me is that you aren't setting the CMDLine1 variable to anything before you later try to use it on the line "ObjShell.Run CMDLine1", is it just that you haven't pasted that bit of the script or did you forget to declare it?
22nd September 2010, 12:32 PM #3
Considering the OP:
Originally Posted by LosOjos
...I guess CMDLine1 used to hold the call to change permissions and the call to it hasn't been removed as it should.
Originally Posted by Johan
22nd September 2010, 01:19 PM #4
Looks fine except for the cmdline1 bit - just delete the whole line:
22nd September 2010, 03:30 PM #5
- Rep Power
Thank you all for your time
By dhorowitz in forum Scripts
Last Post: 23rd July 2010, 07:12 PM
By mossj in forum Web Development
Last Post: 28th March 2010, 12:15 AM
By Paul_L in forum Scripts
Last Post: 2nd October 2008, 02:33 PM
Last Post: 6th November 2007, 11:48 PM
By Galway in forum Windows
Last Post: 29th August 2007, 11:00 AM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)