Arcath (30th June 2009)
i currently have a printer script that looks at the hostname of the computer and uses that to work out what printers it needs.
is it possible to pickup what AD Group the machine is in, that way its much easier when i swap machines around.
it allways appears to return TRUE.
Try this, you will need to alter the group details to match yours.Code:'Connect to AD Set objSysInfo = CreateObject("ADSystemInfo") 'Get LDAP entry to current computer object. strComputerDN = objSysInfo.ComputerName Set objComputer = GetObject("LDAP://" & strComputerDN) 'WScript.Echo strComputerDN 'Sanity Check 'Bind objGroup to LDAP entry for a AD group. Set objGroup = GetObject("LDAP://cn=GroupName,ou=SubOUitsin,ou=OU its in,dc=YourDomain,dc=Domain,dc=ac,dc=uk") 'Check AD Group for computer member if objGroup.IsMember(objComputer.AdsPath) = true then WScript.Echo strComputerDN & " is a member of the AD Group." else WScript.Echo strComputerDN & " is NOT a member of the AD Group." end if
Arcath (30th June 2009)
There are currently 1 users browsing this thread. (0 members and 1 guests)