Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

local group membership 1

Status
Not open for further replies.

bn2hunt

MIS
May 15, 2003
203
0
0
US
Does anyone know of a way to check local group membership of a domain user or group? I need to install a program but the logged on user must have at least local power user rights. I can check for domain group membership but I don't know how to check what local rights they have.

domain = "domainname"
usrnme = "username"
groupname = "Administrators"
flgIsMember = false
Set userObj = GetObject("WinNT://" & domain & "/" & usrnme & ",users"
For Each grp In userObj.Groups
msgbox grp.name
If grp.Name = groupName Then
flgIsMember = True
Exit For
End If
Next
IsMember = flgIsMember
msgbox ismember
Set userObj = nothing

Any ideas I could try will be appreicated.

Thanks
 
Try This ...
Dim sDomain, sGroupSelection
sDomain = InputBox("Enter Computer Name")
sGroupSelected = "Administrators,group"
Set objGroup = GetObject("WinNT://" & sDomain & "/" & sGroupSelected)
For Each objMember in objGroup.Members
On Error Resume Next
If objMember.Class = "User" Then
wsh.echo objMember.Name
wsh.echo objMember.Class & ": " & objMember.Description
End If
Next

Set objGroup = Nothing
 
That gives me the local and domain users that are in the Administrators group but not domain groups that are a member of local Administrators. We use domain groups to give power user access to a entire department on each pc in that department but sometimes that step is missed and just the person sitting at that desk is added. I am trying to verify that correct groups have been added.


Thanks

Dan
 
dont do the
If objMember.Class = "User" Then
 
how would you change this script to a list all local group membership (not just admin) that a domain user belongs to?
I have a user termination list that I need to remove users from a local group accounts who have domain accounts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top