problems mapping network drive

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rupelo78
    New Member
    • Aug 2008
    • 1

    problems mapping network drive

    Morning folks, if you all could loan me a hand it would be sweet.
    New to VB script, so pardon me for the noob ways.

    I am trying to useogon script that would map our HP LaserJet 4600s. all these machines have printservers built in. I use the script below but i keep getting the error that Printer Name is invalid when i test it out on my machine (vista business btw :( ) However I am able to map it manually.

    any assistance would be much appreciated

    Don't know if the below info would be useful

    Print Server
    ip address10.3.7.1 60
    subnet: 255.255.248.0
    gateway 10.3.7.1

    Client Machine
    10.3.1.21
    255.255.248.0
    10.3.0.58


    Code:
    Dim goWshNetwork
    Dim PrinterPath 
    Dim PrinterDriver 
     
     
    Set WshNetwork = CreateObject("WScript.Network")
    PrinterPath = "\\10.3.7.160\hp color LaserJet 4600"
    PrinterDriver = "HP Color LaserJet 4600 PCL5"
     
    Set rc = WshNetwork.AddWindowsPrinterConnection(PrinterPath  , PrinterDriver)
     
    If Not rc Then
          'Error message here
    End If
Working...