Jump to content

Have I done this right? - VB Script


Recommended Posts

Posted

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")

 

Sub ShowSubFolders(Folder)

For Each Subfolder in Folder.SubFolders

WScript.Echo "Folder = " & Subfolder

userName = SubFolder.Name

 

ObjShell.Run CMDLine1

 

CMDLine2 = "chown -r " & userName & " """ & Subfolder & "\*.*"""

 

WScript.Echo "Running CHOWN..."

ObjShell.Run CMDLine2

Next

End Sub

 

 

Would someone with a better understanding of VB than me see if I have made a stupid mistake!?

 

Many thanks,

John.

Posted
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?
Posted
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?

 

Considering the OP:

 

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.

 

...I guess CMDLine1 used to hold the call to change permissions and the call to it hasn't been removed as it should.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...