Loginscript based on group membership

Home Forums Scripting Windows Script Host Loginscript based on group membership

This topic contains 0 replies, has 1 voice, and was last updated by Avatar danny230681 8 years, 3 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    danny230681
    Member
    #154961

    I just wanted to share this with you guys.

    I use this as login script to map drives and set a default printer.
    It is based on group membership.

    It works like this,

    In my example in the Root of ADUC i created a OU called Company Users.
    Under this OU i created a OU Security Groups.
    In here i put all groups i use like: Financial, Support etc.
    I used domain.local as the domain name.

    In the script you see some code like this:

    Quote:
    Set objGroup = GetObject(“LDAP://CN=,OU=Security Groups,OU=,DC=,DC=“)
    If (objGroup.IsMember(strAdsPath) = True) Then
    objNetwork.MapNetworkDrive “Q:”, “\
    End if

    Set objGroup = GetObject(“LDAP://CN=,OU=Security Groups,OU=,DC=,DC=“)
    If (objGroup.IsMember(strAdsPath) = True) Then
    objNetwork.SetDefaultPrinter “
    End If

    You have to replace all text that is all in caps.
    See my example below:

    Quote:
    Set objGroup = GetObject(“LDAP://CN=Financial,OU=Security Groups,OU=Company Users,DC=Domain,DC=local”)
    If (objGroup.IsMember(strAdsPath) = True) Then
    objNetwork.MapNetworkDrive “Q:”, “\FS01Financial”
    End if

    Set objGroup = GetObject(“LDAP://CN=Financial,OU=Security Groups,OU=Company Users,DC=Domain,DC=local”)
    If (objGroup.IsMember(strAdsPath) = True) Then
    objNetwork.SetDefaultPrinter “Laserjet 2600”
    End If

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.