RE: Script to populate a profilePath to ALL Users in an OU by twin
twin
Tue Oct 05 10:53:04 CDT 2004
sorry if someone already thought about it, but i'm a bit impatient so i
"merged" some scripts that i found here and made this working script:
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"SELECT Name FROM 'LDAP://server/ou=Test,dc=domain,dc=com'" & _
"WHERE objectCategory='user'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
On Error Resume Next
objUser.GetInfo
CurrentUserName = objRecordSet.Fields("Name").Value
Set objUser = GetObject _
("LDAP://server/cn=" & CurrentUserName & ",ou=Test,dc=domain,dc=com")
' objUser.Put "scriptPath", "logon.vbs"
objUser.Put "profilePath", "\\server\profiles\" & CurrentUserName
objUser.SetInfo
objRecordSet.MoveNext
Loop
WScript.Echo "ProfilePath was successfully set !"
Thank you !!!
Thomas
"twin" wrote:
> i need some advise in modifying the below script-example so that i can use it
> to give ALL my users in an OU a profilePath because i don't want to add the
> profilePath to each of 800 users manually :-(
> The profilePath should be something like \\server\profiles\%USERNAME%
> The example creates the profilePath for only one user, but i need to create
> them on the fly for all.
>
> Any help is much appreciated !!
>
> regards
> Thomas
>
>
>
>
> Set objUser = GetObject _
> ("LDAP://cn=Myerken,ou=Management,dc=NA,dc=fabrikam,dc=com")
> objUser.Put "profilePath", "\\sea-dc-01\Profiles\myerken"
> objUser.SetInfo
>
>