none
VBscript to change print queue from old to new print server but keep default printer with new queue RRS feed

  • General discussion

  • Hi,

    I am wondering if anyone can help me..

    I have created a vbscript to replace queues pointing to an old print server with queues pointing to a new print server.

    The script will run via group policy when a user logs in.

    It scans their machine to see what printers are installed and if there are any queues pointing to the old print server, they are replaced with the new print server queue.

    The problem I have is I have yet to find a way to scan for the default printer, note it, and set the default as corresponding new print server queue.

    See script below;

    '--------------------------------------------------------------------
    '
    'Program Name       PrinterMigration.VBS
    '
    'Author             Darth Vader
    '
    'Description        VBS Script for The Republic for pointing users print queues to the Death Star Printer Server
    '
    'Edit History       09/01/18      Created
    '                   
    '                   
    '--------------------------------------------------------------------
    ' Get a list of currently connected printers 
    ' and scan for the ones we need to change. 
    ' Process each printer as it is found.

    DefaultPrinter = 

    Set objNetwork = WScript.CreateObject("WScript.Network")
    Set colPrinters = objNetwork.EnumPrinterConnections
    For i = 0 to colPrinters.Count -1 Step 2
      printerfound = "no"
      
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-401" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-401"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-401"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-401" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-401"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-401"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-402" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-402"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-402"
         printerfound = "yes"
     End If

      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-402" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-402"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-402"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-403" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-403"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-403"
         printerfound = "yes"
     End If

      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-403" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-403"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-403"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-404" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-404"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-404"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-404" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-404"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-404"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-405" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-405"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-405"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-405" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-405"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-405"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-406" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-406"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-406"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-406" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-406"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-406"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-407" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-407"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-407"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-407" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-407"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-407"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-408" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-408"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-408"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-408" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-408"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-408"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-409" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-409"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-409"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-409" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-409"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-409"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-410" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-410"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-410"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-410" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-410"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-410"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-411" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-411"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-411"
         printerfound = "yes"
     End If

      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-411" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-411"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-411"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-412" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-412"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-412"
         printerfound = "yes"
     End If

      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-412" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-412"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-412"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-413" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-413"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-413"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-413" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-413"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-413"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-414" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-414"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-414"
         printerfound = "yes"
     End If

      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-414" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-414"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-414"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-415" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-415"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-415"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-415" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-415"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-415"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-416" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-416"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-416"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-416" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-416"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-416"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-417" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-417"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-417"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-417" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-417"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-417"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-418" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-418"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-418"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-418" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-418"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-418"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-419" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-419"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-419"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-419" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-419"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-419"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-420" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-420"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-420"
         printerfound = "yes"
     End If

      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-420" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-420"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-420"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-421" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-421"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-421"
         printerfound = "yes"
     End If

      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-421" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-421"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-421"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-423" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-423"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-423"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-423" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-423"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-423"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-424" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-424"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-424"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-424" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-424"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-424"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-425" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-425"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-425"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-425" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-425"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-425"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-426" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-426"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-426"
         printerfound = "yes"
     End If

      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-426" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-426"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-426"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-427" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-427"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-427"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-427" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-427"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-427"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-488" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-GROUP-488"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-488"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-GROUP-488" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-GROUP-488"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-GROUP-488"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-600" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-600"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-600"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-600" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-600"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-600"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-600-TEST" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-600-TEST"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-600-TEST"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-600-TEST" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-600-TEST"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-600-TEST"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-601" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-601"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-601"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-601" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-601"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-601"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-602" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-602"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-602"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-602" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-602"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-602"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-603" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-603"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-603"
         printerfound = "yes"
     End If

      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-603" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-603"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-603"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-604" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-604"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-604"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-604" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-604"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-604"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-605" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-605"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-605"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-605" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-605"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-605"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-606" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-606"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-606"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-606" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-606"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-606"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-607" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-607"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-607"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-607" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-607"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-607"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-608" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-608"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-608"
         printerfound = "yes"
     End If

      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-608" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-608"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-608"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-609" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-609"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-609"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-609" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-609"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-609"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-610" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-610"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-610"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-610" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-610"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-610"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-611" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PRIVATE-611"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-611"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PRIVATE-611" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PRIVATE-611"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PRIVATE-611"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-001" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-001"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-001"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-001" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-001"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-001"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-002" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-002"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-002"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-002" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-002"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-002"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-003" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-003"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-003"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-003" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-003"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-003"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-004" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-004"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-004"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-004" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-004"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-004"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-005" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-005"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-005"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-005" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-005"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-005"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-006" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-006"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-006"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-006" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-006"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-006"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-007" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-007"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-007"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-007" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-007"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-007"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-008" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-008"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-008"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-008" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-008"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-008"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-009" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-009"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-009"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-009" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-009"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-009"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-010" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-010"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-010"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-010" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-010"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-010"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-011" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-011"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-011"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-011" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-011"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-011"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-012" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-012"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-012"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-012" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-012"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-012"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-013" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-013"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-013"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-013" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-013"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-013"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-014" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-014"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-014"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-014" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-014"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-014"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-140" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-140"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-140"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-140" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-140"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-140"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-197" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-197"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-197"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-197" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-197"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-197"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-015" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-015"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-015"
         printerfound = "yes"
     End If

      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-015" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-015"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-015"
         printerfound = "yes"
     End If
     
     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-016" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-016"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-016"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-016" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-016"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-016"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-422" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\GY-PUBLIC-422"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-422"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\GY-PUBLIC-422" Then 
         oldPrinter = "\\PM3-CGPRINT02\GY-PUBLIC-422"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\GY-PUBLIC-422"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\MONO" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\MONO"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\MONO"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\MONO" Then 
         oldPrinter = "\\PM3-CGPRINT02\MONO"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\MONO"
         printerfound = "yes"
     End If

     If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02.REPUBLIC.COM\COLOUR" Then 
         oldPrinter = "\\PM3-CGPRINT02.REPUBLIC.COM\COLOUR"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\COLOUR"
         printerfound = "yes"
     End If
     
      If UCase(colprinters.Item (i + 1)) = "\\PM3-CGPRINT02\COLOUR" Then 
         oldPrinter = "\\PM3-CGPRINT02\COLOUR"
         newPrinter = "\\IECM1PS101.REPUBLIC.NET\COLOUR"
         printerfound = "yes"
     End If

    If printerfound = "yes" Then
       SwapPrinter
    End If
     
    Next


    WScript.Echo "Printer conversion is now complete"

    WScript.quit

    '*****************************
    ' Begin Subroutines
    '*****************************

    '******************
    Sub  SwapPrinter 

    Set WshNetwork = CreateObject("WScript.Network")

     

    ' This line will add the specified printer. You can add more printers if needed.
    WshNetwork.AddWindowsPrinterConnection newPrinter

    ' This line sets the user's default printer.
    ' WshNetwork.SetDefaultPrinter $newPrinter

    ' This line removes the specified printer.
    WshNetwork.RemovePrinterConnection oldPrinter

    ' If any steps are not needed, comment them out by adding a single quote to the 
    ' beginning of a line - like this one.

    End Sub

    *****************************************************************************************************

    So to clarify;

    If a user has the following printer installed and set as default;

         "\\PM3-CGPRINT02\MONO"

    How do get the script to run  change the print queues as it should and then set the default as;

         "\\IECM1PS101.REPUBLIC.NET\MONO"

    Any help is much appreciated :)

    The Dark Lord

    • Changed type Bill_Stewart Wednesday, February 14, 2018 7:44 PM
    • Moved by Bill_Stewart Wednesday, February 14, 2018 7:45 PM This is not "can someone add feature x to my 300-line script for me" forum
    Wednesday, January 10, 2018 12:18 PM

All replies