+ Post New Thread
Results 1 to 9 of 9
How do you do....it? Thread, Set the AD "Home Path" with a batch file? in Technical; Hi there, Some of our accounts have got screwed up for some reason. I know that there must be a ...
  1. #1
    eejit's Avatar
    Join Date
    Jun 2005
    Location
    Ireland
    Posts
    606
    Thank Post
    52
    Thanked 12 Times in 12 Posts
    Rep Power
    22

    Set the AD "Home Path" with a batch file?

    Hi there,
    Some of our accounts have got screwed up for some reason. I know that there must be a way to add a user's "home path" to Z: \\server\username$ somehow, but I just can't find the command.

    Must be a switch in "net user", but again I can't find it.

    Anyone know how to do it?

    Thanks!

  2. #2
    cookie_monster's Avatar
    Join Date
    May 2007
    Location
    Derbyshire
    Posts
    4,205
    Thank Post
    394
    Thanked 278 Times in 239 Posts
    Rep Power
    74
    I'm not quite sure I follow. Are you trying to change their home folder path with a login script, could you not alter the path in the active directory profile tab?

  3. #3
    eejit's Avatar
    Join Date
    Jun 2005
    Location
    Ireland
    Posts
    606
    Thank Post
    52
    Thanked 12 Times in 12 Posts
    Rep Power
    22
    Yep, I could but there are about 200 I need to change.

    Thanks

  4. #4
    eejit's Avatar
    Join Date
    Jun 2005
    Location
    Ireland
    Posts
    606
    Thank Post
    52
    Thanked 12 Times in 12 Posts
    Rep Power
    22
    This is a bit of my current script

    Code:
    for /f "tokens=1 delims=," %%1 in (2006.txt) do (
    
    net user "%%1" /comment:"2006 Intake" /homedir:"\\server\%%1"$ /scriptpath: /profilepath:\\server\Profiles$\pupil
    Just missing the "/homepath= whatever" bit

    Thanks

  5. #5
    Jon
    Jon is offline
    Jon's Avatar
    Join Date
    May 2006
    Location
    Norfolk
    Posts
    327
    Thank Post
    32
    Thanked 52 Times in 42 Posts
    Rep Power
    22
    You can select them all in ADUC and change them all at the sametime.

    \\servername\%username%$

  6. Thanks to Jon from:

    eejit (14th September 2009)

  7. #6


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    run on each OU

    Code:
    set objParent = GetObject("LDAP://ou=year group,DC=example,DC=college,DC=org")
    
    Set shell = CreateObject("WScript.Shell")
    
    objparent.Filter = Array("user")
    
    
    
    for each objUser in objParent
    
     
    
    
    
    
    
        	objUser.put "homedrive", "Z:"
    
       	objuser.HomeDirectory = "\\server\" & objUser.get("sAMAccountName") 
    
      
    
    				
    
    
    
    
    objuser.Setinfo
    
        
    
    next
    
    
    
    
    
    Wscript.Echo "Done"

  8. Thanks to CyberNerd from:

    eejit (14th September 2009)

  9. #7
    cookie_monster's Avatar
    Join Date
    May 2007
    Location
    Derbyshire
    Posts
    4,205
    Thank Post
    394
    Thanked 278 Times in 239 Posts
    Rep Power
    74
    or do as Jon says that work perfectly it will also set home folder permissions as well.

  10. #8
    eejit's Avatar
    Join Date
    Jun 2005
    Location
    Ireland
    Posts
    606
    Thank Post
    52
    Thanked 12 Times in 12 Posts
    Rep Power
    22
    Quote Originally Posted by Jon View Post
    You can select them all in ADUC and change them all at the sametime.

    \\servername\%username%$

    Doh!
    Yes, thanks - did that. Can't believe I forgot that - early term pressure

  11. #9
    eejit's Avatar
    Join Date
    Jun 2005
    Location
    Ireland
    Posts
    606
    Thank Post
    52
    Thanked 12 Times in 12 Posts
    Rep Power
    22
    CyberNerd, thanks for that. I'll go through that when things ease off and alter my scripts.

    Cheers

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 4
    Last Post: 18th November 2011, 03:36 PM
  2. Replies: 3
    Last Post: 11th September 2009, 09:01 AM
  3. Replies: 7
    Last Post: 12th October 2008, 08:33 PM
  4. Replies: 6
    Last Post: 28th September 2006, 07:06 PM
  5. Replies: 3
    Last Post: 16th February 2006, 12:36 PM

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
  •