Script for testing the Membership of an Computer in an Active Directory Group
This script looks if the actually logged on User is in an specified Active Directory Group: (in this Example: ActiveDirectoryGroup1 or ActiveDirectoryGroup2)
Dim WSHShell, objNET, objSysInfo, objUser, strUserDN, strGroups, Group, GroupName
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set objNET = WScript.CreateObject("WScript.Network")
Set objSysInfo = WScript.CreateObject("ADSystemInfo")
strUserDN = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUserDN)
strGroups = objUser.GetEx("memberOf")
For Each Group in strGroups
Set ThisGroup = GetObject("LDAP://" & Group)
GroupName = ThisGroup.CN
Select Case GroupName
Case "ActiveDirectoryGroup1"
Wscript.echo "User is Member of ActiveDirectoryGroup1"
WScript.Quit(0)
Case "ActiveDirectoryGroup2"
Wscript.echo "User is Member of ActiveDirectoryGroup2"
End Select
Next
(Nr:1) vCkpVAaFgMUdcRXIg schrieb am 05.04.2012 19:43
Hi,I'm not a coder, just a computer eihutsnast who need to know when an account was created on a computer running XP Pro SP3.Where do I type the above code?Do I need to substitute any part of it with the specific account name?Please advice on how to use the above code.Thank you and I appologize for my computer skils not being up to par.Danny
Kommentare die nicht unmittelbar mit diesem Thema zu tun haben,
sowie Supportanfragen oder Hilfe bitte ins Forum posten: Support Forum