I am trying to remove all users from a local group across 150+ server in our environment.
When I run the script I get an error stating 'The specified account is not a member of the local group.'
I have noticed that the users in the group display with a sid in parenthesis after the user name. I asume this is in reference to the sidhistory object of each user.
Any ideas how to get these users removed from the groups?
'***************
Dim objSrvr
Dim objGroup
Dim strPath,strUserPath
' Construct the binding string.
strPath = "WinNT://Servername"
' Bind to object.
Set objSrvr = GetObject(strPath)
' Enumerate groups and members.
objSrvr.Filter = Array("group")
For Each objGroup in objSrvr
If UCase(objGroup.Name) = "HRIS" Then
For Each objMember in objGroup.Members
strUserPath=objMember.adspath
objGroup.remove strUserPath
Next
End If
Next
'***************
Thanks,
Joe P
When I run the script I get an error stating 'The specified account is not a member of the local group.'
I have noticed that the users in the group display with a sid in parenthesis after the user name. I asume this is in reference to the sidhistory object of each user.
Any ideas how to get these users removed from the groups?
'***************
Dim objSrvr
Dim objGroup
Dim strPath,strUserPath
' Construct the binding string.
strPath = "WinNT://Servername"
' Bind to object.
Set objSrvr = GetObject(strPath)
' Enumerate groups and members.
objSrvr.Filter = Array("group")
For Each objGroup in objSrvr
If UCase(objGroup.Name) = "HRIS" Then
For Each objMember in objGroup.Members
strUserPath=objMember.adspath
objGroup.remove strUserPath
Next
End If
Next
'***************
Thanks,
Joe P