Please Read: Significant Update Planned, Migrating Forum Software This Month

See more
See less

Map Drives according to User Groups

  • Filter
  • Time
  • Show
Clear All
new posts

  • Map Drives according to User Groups


    i am trying to map drives accoring to the group a user is in.

    I am running Windows 2003 Server and Exchange 2003. Client machines are running Windows XP.

    the login script i am trying to use was from the microsoft technet site.(

    i have modified it to a basic map to try get it working.

    Const FINANCE_GROUP = "cn=finance"
    Const ADMIN_GROUP = "cn=admin"

    Set wshNetwork = CreateObject("WScript.Network")

    Set ADSysInfo = CreateObject("ADSystemInfo")
    Set CurrentUser = GetObject("LDAP://" &
    strGroups = LCase(Join(CurrentUser.MemberOf))

    If InStr(strGroups, FINANCE_GROUP) Then

    wshNetwork.MapNetworkDrive "g:",

    ElseIf InStr(strGroups, ADMIN_GROUP) Then

    wshNetwork.MapNetworkDrive "p:",

    End If

    i then add this script to the user in AD.

    when i log into the domain as that user i get an error:network domain does not exist or could not be contacted. Error is on the Set CurrentUser Line.

    I ran the script on the server and it runs great, mapping the correct drives for the Administrator account.

    I tried logging in as Administrator account on a client machine however it gives me the same error mentioned above.

    So there is some permission issues for network machine.

    Any ideas howi can get around this problem please?
    Last edited by morjo; 9th November 2005, 04:30. Reason: new info

  • #2
    Re: Map Drives according to User Groups


    I'm no programmer or scripter so I can't tell you whats wrong with your script, but I do like to use and modify public ones.

    Have a look at:

    I use a modified script from that site and it works just fine.
    This one i think..

    Note: the above script doesn't handle root-mapping that well. If you want to use root-maps you must use
    instead for the MapDrive function. Of course, I could be wrong and you can change the MapDrive function to handle root-maps, but that is beyond me.

    Good luck



    • #3
      Re: Map Drives according to User Groups

      Try looking at this thread:
      Server 2000 MCP
      Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog

      ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **