Modify Users per security group membership

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
 
R

Richard Mueller

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top