Modify Users per security group membership

  • Thread starter Thread starter tcrowley1999
  • Start date Start date
T

tcrowley1999

I'm trying to use the script below for
Each user in the security group Home I want to change the logon script
to Hdrive.vbs
When I run the script nothing happens.
This script works if I want to change users in an OU.


Set objOU = GetObject("LDAP://cn=home,ou=groups,dc=test,dc=com")


objOU.Filter = Array("user")


For Each objUser In objOU
objUser.Put "ScriptPath", "Hdrive.vbs"
objUser.SetInfo
Next


Thanks
Tim
 
Tim said:
I'm trying to use the script below for
Each user in the security group Home I want to change the logon script
to Hdrive.vbs
When I run the script nothing happens.
This script works if I want to change users in an OU.


Set objOU = GetObject("LDAP://cn=home,ou=groups,dc=test,dc=com")


objOU.Filter = Array("user")


For Each objUser In objOU
objUser.Put "ScriptPath", "Hdrive.vbs"
objUser.SetInfo
Next

Hi,

Your script would work if cn=Home were a container. I assume it is a group.
To enumerate the direct members of group, use the Members method of the
group object:

Set objGroup = GetObject("LDAP://cn=Home,ou=Groups,dc=Test,dc=com")

For Each objUser in objGroup.Members
objUser.Put "scriptPath", "Hdrive.vbs"
objUser.SetInfo
Next
 
Back
Top