FthrJACK Posted May 15, 2008 Share Posted May 15, 2008 (edited) Im trying to figure out a way to edit a group of users under an OU, tried using script but on running the script i get the errorId like to edit the Profiles path of a group of users and set it to something like:\\someserver\PROFILES$\%USERNAME%....for every user in the OU i run it on. That or have sort of template setup so everytime a new user is made from now on all the profile and home dir settings are already filled in.does anyone know of a toy do do this, or how to do it with scripting?The script :Set ObjOU=GetObject ("LDAP://OU=" + InputBox("Enter OU To Edit") +",DC=WORKGROUP,DC=LOCAL")objOU.filter=array("user")For Each ObjUser In ObjOU'ObjUser.Put "profilePath" , "\\Server2\USER_PROFILES$\" +ObjUser.sAMAccountNameObjUser.SetInfoNextSet objOU = Nothingis the one giving the error, running it from cmd prompt. Edited May 15, 2008 by FthrJACK Link to comment Share on other sites More sharing options...
FthrJACK Posted May 15, 2008 Author Share Posted May 15, 2008 (edited) oh well, sorry wrong section. This board seriously needs an Active Directory forum tho....Anyway, the error above was caused by a dodgy line break at the end of line 5.. shouldnt have been there. Now the script runs with no error. BUT... users profile path doesent seem to be getting set. any ideas? Edited May 15, 2008 by FthrJACK Link to comment Share on other sites More sharing options...
FthrJACK Posted May 15, 2008 Author Share Posted May 15, 2008 (edited) Ok... fixed it.silly me left a stray single quote in there, commenting the line out.. DOH!also tweeked it to add trailing slash to end of user profile... can cause funky errors without it there.Working script:On Error Resume NextSet ObjOU=GetObject ("LDAP://OU=" + InputBox("Enter OU To Edit") +",DC=WORKGROUP,DC=LOCAL")objOU.filter=array("user")For Each ObjUser In ObjOUObjUser.Put "profilePath" , "\\Server2\USER_PROFILES$\" +ObjUser.sAMAccountName +"\"ObjUser.SetInfoNextSet objOU = Nothing Edited May 29, 2008 by FthrJACK Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now