Hi all,
I've had the following script that disables AD users but my requirements have recently changed. I now need to disable any active accounts but only if they are in the 'Domain Admin' group.
My script is below. What can I add to my If statement to check the group the user is in?
Thanks!
CONST sInactiveUsersOU = "LDAP://ou=Disabled Accounts,DC=corp,DC=somebank,DC=com"
Set objOU = GetObject(sInactiveUsersOU)
objOU.Filter = Array("user")
For Each objUser In objOU
'-- If it's enabled, disable it
If objUser.AccountDisabled = FALSE Then
objUser.AccountDisabled = TRUE
objUser.Put "description", "##### Disabled by system " & Now
objUser.SetInfo
End If
Next
set objOU = Nothing
Set objUserr = Nothing
I've had the following script that disables AD users but my requirements have recently changed. I now need to disable any active accounts but only if they are in the 'Domain Admin' group.
My script is below. What can I add to my If statement to check the group the user is in?
Thanks!
CONST sInactiveUsersOU = "LDAP://ou=Disabled Accounts,DC=corp,DC=somebank,DC=com"
Set objOU = GetObject(sInactiveUsersOU)
objOU.Filter = Array("user")
For Each objUser In objOU
'-- If it's enabled, disable it
If objUser.AccountDisabled = FALSE Then
objUser.AccountDisabled = TRUE
objUser.Put "description", "##### Disabled by system " & Now
objUser.SetInfo
End If
Next
set objOU = Nothing
Set objUserr = Nothing