This script finds out if the logged on user is a member of a group. This is very handy for logon scripts.
' Find the user logged in
Set WSHShell = CreateObject("WScript.Shell")
UserLoggedIn = WshShell.ExpandEnvironmentStrings("%username%")
'Run the functions if the user is a member of the group
Set oGroup = getobject("WinNT://kbomb.local/" & "Domain Admins")
For Each oMember in oGroup.Members
If lcase(oMember.Name) = lcase(UserLoggedIn) Then
RunRegModifications()
RunFileModifications()
End If
Next
Function RunRegModifications()
wscript.echo "reg modification code here"
End Function
Function RunFileModifications()
wscript.echo "file modification code here"
End Function
Subscribe to:
Post Comments (Atom)
Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.
ReplyDeletenice, finding out if one is a member of a group can be pretty convenient
ReplyDeletethanks, Clint