Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2006
    Posts
    1

    Unanswered: Mapping users drives department drives and printers

    Hello everyone,
    I hope I am posting this in the right place. I don't know a lot about vb, and I have only learned about it in the last 2 weeks or so from researching it on the web.

    I am having a real problem trying to set up a script that will map a users own personal drive (z) their department drive (y) and 2 network printers each.

    I am trying to run this through Group policy and I am seeming to get all different types of errors with each change I make.

    I have set up test groups and users before attempting to run this live.
    I have user Test1 in a OU and group called 1Test with department drive Testa
    Test2 in OU and group policy called 2Test with department drive Testb
    Test3 in OU and GP called 3Test with department drive Testb
    Test4 in OU and GP 4Test with drive Testd

    My network printers are \\fileserver\hplaserj and \\fileserver\INEO_350
    My server is called fileserver and all the department drives are on \\fileserver\

    The script I have is called script2.vbs and is in the

    \\domain.local\SysVol\dldc.local\Policies\{F03042C 3-1C57-4060-99F1-745AF7D8E2BB}\User\Scripts\Logon

    and is "pointed to" 1Test - User configuration - windows settings - scripts logon

    I am using this script which I got as a template and have edited to suit.

    Const 1TEST_GROUP = "cn=1test"
    Const 2TEST_GROUP = "cn=2test"
    Const 3TEST_GROUP = "cn=3test"
    Const 4TEST_GROUP = "cn=4test"

    Set wshNetwork = CreateObject("WScript.Network")
    wshNetwork.MapNetworkDrive "Z:","\\FileServer"& wshNetwork.UserName

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

    If InStr(strGroups, TEST1_GROUP) Then

    wshNetwork.MapNetworkDrive "y:","\\FileServer\testa"
    wshNetwork.AddWindowsPrinterConnection"\\FileServe r\hpLaserj"
    wshNetwork.AddWindowsPrinterConnection"\\fileServe r\ineo_350"
    wshNetWork.SetDefaultPrinter"\\fileServer\ineo_350 "

    ElseIf InStr(strGroups, TEST2_GROUP) Then

    wshNetwork.MapNetworkDrive "y:","\\FileServer\testb"
    wshNetwork.AddWindowsPrinterConnection "\\fileServer\hpLaserj"
    wshNetwork.AddWindowsPrinterConnection "\\fileServer\ineo_350"
    wshNetWork.SetDefaultPrinter "\\fileserver\ineo_350"

    ElseIf InStr(strGroups, TEST3_GROUP) Then

    wshNetwork.MapNetworkDrive "y:", "\\FileServer\testc"
    wshNetwork.AddWindowsPrinterConnection "\\fileServer\HpLaserj"
    wshNetwork.AddWindowsPrinterConnection "\\fileServer\ineo_350"
    wshNetWork.SetDefaultPrinter "\\fileServer\ineo_350"

    ElseIf InStr(strGroups, TEST4_GROUP) Then

    wshNetwork.MapNetworkDrive "y:", "\\FileServer\testd"
    wshNetwork.AddWindowsPrinterConnection "\\fileServer\HpLaserj"
    wshNetwork.AddWindowsPrinterConnection "\\fileServer\ineo_350"
    wshNetWork.SetDefaultPrinter "\\fileServer\ineo_350"

    End If
    When I login as any of the users (ie Test1) I am currently getting Error: Expected Identifier, code: 800A03F2 Line:1 Char: 7

    I have checked the script (the best I can!) and can't find a way to solve this.
    Please could anyone help me with this as I have been trying to get this fixed for the last 2 weeks and really am at a complete loss. Any help would be greatly appreciated (and appologies for the length of this post)

  2. #2
    Join Date
    Dec 2006
    Posts
    1
    It's more suitable to use other ways - for example kix scripts or even better special scripting tools. But maybe I'm saying this way because I'm not so good at scripting and this work is for Desktop Authority - our network management solution. You need to check it out also. You will be able to perform drive and printer mappings selectively to your users with help of validation logic. It's very useful in the way with different mappings according to departments.

Posting Permissions

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