Jump to content

AD Server2k: Script editing Users?


Recommended Posts

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 error

errorAD.gif

Id 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.sAMAccountName

ObjUser.SetInfo
Next
Set objOU = Nothing

is the one giving the error, running it from cmd prompt.

Edited by FthrJACK
Link to comment
Share on other sites


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 by FthrJACK
Link to comment
Share on other sites

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 Next
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.sAMAccountName +"\"

ObjUser.SetInfo
Next
Set objOU = Nothing

Edited by FthrJACK
Link to comment
Share on other sites

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...