+ Post New Thread
Results 1 to 5 of 5
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 ...
  1. #1
    Johan's Avatar
    Join Date
    Sep 2009
    Posts
    26
    Thank Post
    7
    Thanked 0 Times in 0 Posts
    Rep Power
    0

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

    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.

  2. #2

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,483
    Thank Post
    1,445
    Thanked 1,179 Times in 806 Posts
    Rep Power
    708
    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?

  3. #3

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    Quote Originally Posted by LosOjos View Post
    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:

    Quote Originally Posted by Johan View Post
    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.

  4. #4

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,156
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    Looks fine except for the cmdline1 bit - just delete the whole line:

    ObjShell.Run CMDLine1

  5. #5
    Johan's Avatar
    Join Date
    Sep 2009
    Posts
    26
    Thank Post
    7
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thank you all for your time

SHARE:
+ Post New Thread

Similar Threads

  1. Script help
    By dhorowitz in forum Scripts
    Replies: 6
    Last Post: 23rd July 2010, 07:12 PM
  2. What Script?
    By mossj in forum Web Development
    Replies: 10
    Last Post: 28th March 2010, 12:15 AM
  3. Need a Script if Possible
    By Paul_L in forum Scripts
    Replies: 6
    Last Post: 2nd October 2008, 02:33 PM
  4. Best script ever!
    By Zabu in forum Scripts
    Replies: 0
    Last Post: 6th November 2007, 11:48 PM
  5. Logon script & Printer script question.
    By Galway in forum Windows
    Replies: 3
    Last Post: 29th August 2007, 11:00 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •