Deployment Solution

 View Only
  • 1.  VB Script for Print Server Migration

    Posted Mar 17, 2011 04:02 AM

    We have got a new Print Server.

     

    The printers are working fine on it.

     

    I am trying to update the printers on client computers and don't want to do it manually. To accompolish this I am using a VBS however its not working from DS.

    The VBS is as follows:

    On Error Resume Next

     

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set wn = WScript.CreateObject("WScript.Network")
    Set ntsm = WScript.CreateObject("WScript.Shell")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer",,48)
    For Each objItem in colItems
    Dim printer, server
    printer = objItem.ShareName
    server  = objItem.ServerName
    If server Is "\\<Old Server>" Then
    wn.RemovePrinterConnection "\\<Old Server>\" &printer
    wn.AddWindowsPrinterConnection "\\<New Server>\" &printer, printer, True
    End If
    Next
     
    If I run this script direclty going to the location, its working fine but if I create a job to run the script from DS it doesn't do anything. I get a green check mark indicating that it has successfully ran the script but nothing happens on the client.
     
    DS 6.9 SP4 Client: Win XP Pro


  • 2.  RE: VB Script for Print Server Migration
    Best Answer

    Posted Mar 17, 2011 09:01 AM

    On the machines that are failing, is the machine logged in?  Network printers are usually profile specific.

    How is the script being run?  You'll probably want to make sure that "Client Run Environment" is set to "run script in console user session" instead of the default (local system account).

    Because some computers might have multiple users, it might be best to put this in a login script, this would ensure each user's printers are taken care of.



  • 3.  RE: VB Script for Print Server Migration

    Posted Mar 19, 2011 06:40 AM

    Client Run Environment is set to 'Run script in console user session'.

     

    Login script, you mean GPO?



  • 4.  RE: VB Script for Print Server Migration

    Posted Mar 19, 2011 08:24 AM

    I tried the GPO and it worked.

     

    Thanks for the tip!

     

    I am so much into DS for eveything that I forgot about GPO smiley