locked
Login script based on location RRS feed

  • Question

  • Hello, we have multi-site domain controllers/file servers. I'm looking for a login script that will allow a user to properly map local shares and printers based on what jobsite they're at. Can anyone point me in the right direction?
    Monday, January 4, 2010 7:59 PM

Answers

  • One option to consider is using Item Level Targeting of Group Policy Preferences (which would eliminate the need for logon script altogether). More info at http://technet.microsoft.com/en-us/library/cc733022.aspx

    Another is to incorporate a logic into a logon script that checks for the local IP address, compares it to a predefined list of subnets, and creates drive/printer mappings accordingly...

    Still another is to use DFS for shares and map printers on per computer - rather than per user basis...

    hth
    Marcin

    • Proposed as answer by Mervyn Zhang Tuesday, January 5, 2010 6:23 AM
    • Marked as answer by Mervyn Zhang Tuesday, January 5, 2010 6:23 AM
    Monday, January 4, 2010 8:05 PM
  • You can configure logon scripts in a Group Policy that applies to a site. Also, you can retrieve the name of the site the computer authenticated to from the ADSystemInfo object in a VBScript logon script. For example:

    Set objSysInfo = CreateObject("ADSystemInfo")
    strSite = objSysInfo.SiteName
    
    Set objNetwork = CreateObject("Wscript.Network")
    
    Select Case strSite
        Case "MySite"
            objNetwork.MapNetworkDrive "M:", "\\MyServer\MyShare"
        Case "Site2"
            objNetwork.MapNetworkDrive "M:", "\\Server2\Share2"
    End Select

    You can also retrieve the Distinguished Names of the user and computer objects from the ADSystemInfo object.

    Richard Mueller


    MVP ADSI
    • Marked as answer by Mervyn Zhang Tuesday, January 5, 2010 6:23 AM
    Monday, January 4, 2010 11:03 PM

All replies

  • One option to consider is using Item Level Targeting of Group Policy Preferences (which would eliminate the need for logon script altogether). More info at http://technet.microsoft.com/en-us/library/cc733022.aspx

    Another is to incorporate a logic into a logon script that checks for the local IP address, compares it to a predefined list of subnets, and creates drive/printer mappings accordingly...

    Still another is to use DFS for shares and map printers on per computer - rather than per user basis...

    hth
    Marcin

    • Proposed as answer by Mervyn Zhang Tuesday, January 5, 2010 6:23 AM
    • Marked as answer by Mervyn Zhang Tuesday, January 5, 2010 6:23 AM
    Monday, January 4, 2010 8:05 PM
  • You can configure logon scripts in a Group Policy that applies to a site. Also, you can retrieve the name of the site the computer authenticated to from the ADSystemInfo object in a VBScript logon script. For example:

    Set objSysInfo = CreateObject("ADSystemInfo")
    strSite = objSysInfo.SiteName
    
    Set objNetwork = CreateObject("Wscript.Network")
    
    Select Case strSite
        Case "MySite"
            objNetwork.MapNetworkDrive "M:", "\\MyServer\MyShare"
        Case "Site2"
            objNetwork.MapNetworkDrive "M:", "\\Server2\Share2"
    End Select

    You can also retrieve the Distinguished Names of the user and computer objects from the ADSystemInfo object.

    Richard Mueller


    MVP ADSI
    • Marked as answer by Mervyn Zhang Tuesday, January 5, 2010 6:23 AM
    Monday, January 4, 2010 11:03 PM