Results 1 to 3 of 3

Thread: Problems with Logon.vbs

  1. #1
    Join Date
    Jun 2009
    Posts
    2

    Problems with Logon.vbs

    Hello,

    I am struggling with setting up a new logon.vbs. I have never had to create one from scratch, and even longer since I have had to write VB. I am able to only map one drive when I run the script and that is the drive specific to the user or what I call the "P:\" drive. I get no errors, but also no other drives mapped. I used the example provided from the Help topic on the domain conctroller. At this point, I am not worried about printers, so I am just trying to get drives mapped. Please see script below:

    Const ENGINEERING_GROUP = "cn=AHCEngineering"
    Const SALES_GROUP = "cn=AHCSales"
    Const HUMAN_RESOURCES_GROUP = "cn=AHCHR"
    Const IT_GROUP = "cn=ACHIT"
    Const ACCOUNTING_GROUP = "cn=ACHAccounting"

    Set wshNetwork = CreateObject("WScript.Network")
    wshNetwork.MapNetworkDrive "P:", "\\agph-admin\Private\" & wshNetwork.UserName

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

    If InStr(strGroups, ENGINEERING_GROUP) Then

    wshNetwork.MapNetworkDrive "F:", "\\agph-admin\Engineering\"

    ElseIf InStr(strGroups, SALES_GROUP) Then

    wshNetwork.MapNetworkDrive "R:", "\\agph-admin\Sales\"

    ElseIf InStr(strGroups, HUMAN_RESOURCES_GROUP) Then

    wshNetwork.MapNetworkDrive "S:", "\\agph-admin\HR\"

    ElseIf InStr(strGroups, IT_GROUP) Then

    wshNetwork.MapNetworkDrive "I:", "\\adhdc1\IT\"
    wshNetwork.MapNetworkDrive "F:", "\\agph-admin\Engineering\"
    wshNetwork.MapNetworkDrive "S:", "\\agph-admin\HR\"
    wshNetwork.MapNetworkDrive "T:", "\\agph-admin\Accounting\"

    ElseIf InStr(strGroups, ACCOUNTING_GROUP) Then

    wshNetwork.MapNetworkDrive "T:", "\\agph-admin\Accounting\"

    End If



    Thanks!
    Dan

  2. #2
    Join Date
    Dec 2008
    Posts
    123

    Problems with Logon.vbs

    before going ahead you need to check it out does your drive is being mapped or not for that use the following code

    Code:
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objNetwork = CreateObject("WScript.Network")
    objNetwork.AddWindowsPrinterConnection "\\veisbs\HP LaserJet 8150 PS"
    objNetwork.AddWindowsPrinterConnection "\\Homer1\7520_PCL"
    objNetwork.AddWindowsPrinterConnection "\\Homer1\7520_ps"
    objNetwork.AddWindowsPrinterConnection "\\Homer1\hp4100"
    objNetwork.AddWindowsPrinterConnection "\\Homer1\HP7500"
    objNetwork.AddWindowsPrinterConnection "\\6L8D3F1\DYMO LabelWriter 330 USB"
    objNetwork.AddWindowsPrinterConnection "\\D1DHH061\DYMO LabelWriter 400 "
    strDriveLetterI = "I:"
    strDriveLetterW = "W:"
    strRemotePath2 = "\\veisbs\data1" 
    strRemotePath3 = "\\veisbs\data1\product\Cases - Electronic Docs" 
    If objFSO.DriveExists(strDriveLetterI) = True Then objNetwork.RemoveNetworkDrive strDriveLetterI, True
    If objFSO.DriveExists(strDriveLetterW) = True Then objNetwork.RemoveNetworkDrive strDriveLetterW, True
    WScript.Sleep 1000
    objNetwork.MapNetworkDrive strDriveLetterI, strRemotePath2
    objNetwork.MapNetworkDrive strDriveLetterW, strRemotePath3
    At the same time also check the below link too

    http://forums.techarena.in/server-scripting/1139356.htm

  3. #3
    Join Date
    Jun 2009
    Posts
    2

    Re: Problems with Logon.vbs

    I am able to map drives using the code above. Not sure how to proceed now...

Similar Threads

  1. Replies: 5
    Last Post: 14-04-2012, 10:22 AM
  2. Replies: 3
    Last Post: 08-06-2011, 03:21 PM
  3. Replies: 3
    Last Post: 17-08-2010, 09:06 PM
  4. Replies: 5
    Last Post: 26-10-2009, 07:20 PM
  5. Replies: 2
    Last Post: 27-11-2008, 07:23 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,716,388,715.87676 seconds with 16 queries