+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, AD Group in vbs in Coding and Web Development; i currently have a printer script that looks at the hostname of the computer and uses that to work out ...
  1. #1
    Arcath's Avatar
    Join Date
    Feb 2009
    Location
    Lancashire
    Posts
    972
    Thank Post
    102
    Thanked 116 Times in 101 Posts
    Rep Power
    74

    AD Group in vbs

    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.

  2. #2
    Arcath's Avatar
    Join Date
    Feb 2009
    Location
    Lancashire
    Posts
    972
    Thank Post
    102
    Thanked 116 Times in 101 Posts
    Rep Power
    74
    it allways appears to return TRUE.

  3. #3
    apeo's Avatar
    Join Date
    Sep 2005
    Location
    Lost
    Posts
    1,612
    Thank Post
    95
    Thanked 115 Times in 111 Posts
    Rep Power
    41
    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
    Try this, you will need to alter the group details to match yours.

  4. Thanks to apeo from:

    Arcath (30th June 2009)

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 2
    Last Post: 27th January 2011, 12:06 PM
  2. Group Policy
    By Iain.Faulkner in forum Windows Server 2000/2003
    Replies: 0
    Last Post: 30th April 2009, 04:16 PM
  3. Script to add a group to a group
    By Quackers in forum Windows
    Replies: 8
    Last Post: 9th December 2008, 10:27 AM
  4. The TI Group
    By wesleyw in forum General Chat
    Replies: 3
    Last Post: 31st October 2008, 01:00 AM
  5. Group Policy
    By faza in forum Wireless Networks
    Replies: 27
    Last Post: 5th July 2006, 06:34 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •