damienenglish
Technical User
Hello Everyone
I am a real beginner at VBS but I have come up with the following script:
Const ADS_UF_ACCOUNTDISABLE = 2
Set objOU = GetObject("LDAP://ou=blah,ou=blah,ou=blah,ou=Site,ou=mainOU,dc=domain,dc=NET")
For Each objUser In objOU
If objUser.class="user" then
objUser.AccountDisabled = True
objUser.SetInfo
objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo
End if
Next
Set objOU = Nothing
Set objColUsers = GetObject _
("LDAP://ou=blah,ou=blah,ou=blah,ou=Site,ou=mainOU,dc=domain,dc=NET")
For Each objUser In objColUsers
ObjUser.msExchHideFromAddressLists = True
objUser.SetInfo
Next
What I want to add next, is a method that will remove all Security Groups from all user accounts within my specific OU. I have found many examples of removing groups from a particular user, or a particular Group from all users, but I require it to remove all security groups from all users apart from the Primary User Group.
Anyone have any suggestions or can this not be done?
Many Thanks
I am a real beginner at VBS but I have come up with the following script:
Const ADS_UF_ACCOUNTDISABLE = 2
Set objOU = GetObject("LDAP://ou=blah,ou=blah,ou=blah,ou=Site,ou=mainOU,dc=domain,dc=NET")
For Each objUser In objOU
If objUser.class="user" then
objUser.AccountDisabled = True
objUser.SetInfo
objUser.Put "userAccountControl", intUAC OR ADS_UF_ACCOUNTDISABLE
objUser.SetInfo
End if
Next
Set objOU = Nothing
Set objColUsers = GetObject _
("LDAP://ou=blah,ou=blah,ou=blah,ou=Site,ou=mainOU,dc=domain,dc=NET")
For Each objUser In objColUsers
ObjUser.msExchHideFromAddressLists = True
objUser.SetInfo
Next
What I want to add next, is a method that will remove all Security Groups from all user accounts within my specific OU. I have found many examples of removing groups from a particular user, or a particular Group from all users, but I require it to remove all security groups from all users apart from the Primary User Group.
Anyone have any suggestions or can this not be done?
Many Thanks