by Donald O'Neill ()
Category: Miscellaneous
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Wed 18th August 2010
Date Added: Mon 8th February 2021
Rating: (1 Votes)
checks if user is in group then adds user to local admins on PC
strDomain = objWshNet.UserDomain
strComputer = objWshNet.ComputerName
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
' Configure to add a domain user to the Local Administrators Group
strUser = objWshNet.UserName
Set objUser = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")
set objDomaingroup = getobject("LDAP://CN=WKLocalAdmin,OU=Groups,DC=home,DC=com")
If objDomaingroup.IsMember(objUser.ADsPath) Then
objGroup.Add(objUser.ADsPath)
End If
'If Not objGroup.IsMember(objUser.ADsPath) Then
' objGroup.Add(objUser.ADsPath)
' End If
No comments have been posted about checks if user is in group then adds user to local admins on PC. Why not be the first to post a comment about checks if user is in group then adds user to local admins on PC.