Announcement

Collapse
No announcement yet.

Loginscript based on group membership

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Loginscript based on group membership

    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:

    Set objGroup = GetObject("LDAP://CN=<GROUP MEMBERSHIP>,OU=Security Groups,OU=<USERS OU>,DC=<DOMAIN>,DC=<DOMAIN EXTENSION>")
    If (objGroup.IsMember(strAdsPath) = True) Then
    objNetwork.MapNetworkDrive "Q:", "\\<SERVERNAME>\<SHARENAME>"
    End if

    Set objGroup = GetObject("LDAP://CN=<GROUP MEMBERSHIP>,OU=Security Groups,OU=<USERS OU>,DC=<DOMAIN>,DC=<DOMAIN EXTENSION>")
    If (objGroup.IsMember(strAdsPath) = True) Then
    objNetwork.SetDefaultPrinter "<PRINTER SHARE NAME>"
    End If
    You have to replace all text that is all in caps.
    See my example below:

    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:", "\\FS01\Financial"
    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
    Attached Files
    Last edited by danny230681; 20th June 2011, 13:33.
Working...
X