-- StephenNickerson - 2016-03-15

Notes from setting up direct printing from scspc392 to xrxpr004 (ST #103000)

  1. Create the printer port name.
    Add-PrinterPort -Name "DC-3322-WorkCentre-7535" -PrinterHostAddress "172.19.33.39" -ComputerName scspc392.cs.uwaterloo.ca
  2. Add the printer using the printer port created in step 1.
    Add-Printer -Name "xrxpr004 - DC 3322 - Xerox WorkCentre 7535 PS" -DriverName "Xerox WorkCentre 7535 PS" -PortName "DC-3322-WorkCentre-7535" -ComputerName scspc392.cs.uwaterloo.ca

Printer-related PowerShell research notes

Notes taken from (ST #98848) Thu, Aug 20 2015 16:19 Stephen Nickerson (snickers) commented Did research on removing printer-related objects on windows machines via powershell.

Here is a summary of a bunch of stuff learned.

Load PrintManagement module Get-Command –Module PrintManagement

    PS C:\Users\snickers> Get-Command –Module PrintManagement 

    CommandType     Name                                               ModuleName 
    -----------     ----                                               ---------- 
    Function        Add-Printer                                        PrintManagement 
    Function        Add-PrinterDriver                                  PrintManagement 
    Function        Add-PrinterPort                                    PrintManagement 
    Function        Get-PrintConfiguration                             PrintManagement 
    Function        Get-Printer                                        PrintManagement 
    Function        Get-PrinterDriver                                  PrintManagement 
    Function        Get-PrinterPort                                    PrintManagement 
    Function        Get-PrinterProperty                                PrintManagement 
    Function        Get-PrintJob                                       PrintManagement 
    Function        Read-PrinterNfcTag                                 PrintManagement 
    Function        Remove-Printer                                     PrintManagement 
    Function        Remove-PrinterDriver                               PrintManagement 
    Function        Remove-PrinterPort                                 PrintManagement 
    Function        Remove-PrintJob                                    PrintManagement 
    Function        Rename-Printer                                     PrintManagement 
    Function        Restart-PrintJob                                   PrintManagement 
    Function        Resume-PrintJob                                    PrintManagement 
    Function        Set-PrintConfiguration                             PrintManagement 
    Function        Set-Printer                                        PrintManagement 
    Function        Set-PrinterProperty                                PrintManagement 
    Function        Suspend-PrintJob                                   PrintManagement 
    Function        Write-PrinterNfcTag                                PrintManagement 

Get a list of printers

    PS C:\Users\snickers> get-printer 

    Name                           ComputerName    Type         DriverName                PortName        Shared   Published 
    ----                           ------------    ----         ----------                --------        ------   -------- 
    Send To OneNote 2013                           Local        Send to Microsoft OneN... nul:            False    False 
    Microsoft XPS Document Writer                  Local        Microsoft XPS Document... PORTPROMPT:     False    False 
    [[http://print.cs.uwaterloo.c.../][http://print.cs.uwaterloo.c...]]                 Local        HP Universal Printing PS  [[http://print.../][http://print...]] False    False 
    HP LaserJet P2015 Series UP...                 Local        HP Universal Printing PS  USB004          False    False 
    HP LaserJet 400 MFP M425 PCL 6                 Local        HP LaserJet 400 MFP M4... HPLaserJet40... False    False 
    Fax                                            Local        Microsoft Shared Fax D... SHRFAX:         False    False 

Get a list of printer drivers

    PS C:\Users\snickers> get-printerdriver 

    Name                                PrinterEnvironment MajorVersion    Manufacturer 
    ----                                ------------------ ------------    ------------ 
    Send to Microsoft OneNote 15 Driver Windows x64        4               Microsoft 
    Microsoft XPS Document Writer v4    Windows x64        4               Microsoft 
    Canon Inkjet MX410 series           Windows x64        4               Canon 
    Microsoft Shared Fax Driver         Windows x64        3               Microsoft 
    Microsoft enhanced Point and Pri... Windows x64        3               Microsoft 
    HP Universal Printing PS            Windows x64        3               HP 
    HP LaserJet 400 MFP M425 PCL 6      Windows x64        3               HP 
    DYMO LabelWriter 450                Windows x64        3               DYMO 
    Canon MX410 series Printer          Windows x64        3               Canon 
    Canon MX410 series FAX              Windows x64        3               Canon 
    Brother QL-550                      Windows x64        3               Brother 
    Microsoft enhanced Point and Pri... Windows NT x86     3               Microsoft 

Get a list of printer ports

    PS C:\Users\snickers> get-printerport 

    Name                 ComputerName         Description          PortMonitor 
    ----                 ------------         -----------          ----------- 
    [[http://print.cs.u.../][http://print.cs.u...]]                      Standard TCP/IP Port TCPMON.DLL 
    LPT1:                                     Local Port           Local Monitor 
    COM3:                                     Local Port           Local Monitor 
    LPT2:                                     Local Port           Local Monitor 
    COM4:                                     Local Port           Local Monitor 
    LPT3:                                     Local Port           Local Monitor 
    PORTPROMPT:                               Local Port           Local Monitor 
    FILE:                                     Local Port           Local Monitor 
    COM1:                                     Local Port           Local Monitor 
    COM2:                                     Local Port           Local Monitor 
    nul:                                      Local Port           Local Monitor 
    HPLaserJet400MFPM...                      HP Standard TCP/I... HPTCPMON.DLL 
    SHRFAX:                                   Fax Monitor Port     Microsoft Shared ... 
    USB004                                    Virtual printer p... Dynamic Print Mon... 

Get a list of printer port names only

    PS C:\Users\snickers> get-printerport | select name 

    name 
    ---- 
    COM1: 
    COM2: 
    COM3: 
    COM4: 
    FILE: 
    [[http://print.cs.uwaterloo.ca:631/printers/lj_cs][http://print.cs.uwaterloo.ca:631/printers/lj_cs]] 
    LPT1: 
    LPT2: 
    LPT3: 
    nul: 
    PORTPROMPT: 
    HPLaserJet400MFPM425dn 
    SHRFAX: 
    USB004 

Get the printer port of a specific printer

Method 1

        PS C:\Users\snickers> get-printerport | where name -eq 'HPLaserJet400MFPM425dn' 

        Name                 ComputerName         Description          PortMonitor 
        ----                 ------------         -----------          ----------- 
        HPLaserJet400MFPM...                      HP Standard TCP/I... HPTCPMON.DLL 

Method 2

        PS C:\Users\snickers>  get-printerport -name "HPLaserJet400MFPM425dn" 

        Name                 ComputerName         Description          PortMonitor 
        ----                 ------------         -----------          ----------- 
        HPLaserJet400MFPM...                      HP Standard TCP/I... HPTCPMON.DLL 

Without headers

PS C:\Users\snickers> get-printerport -name "HPLaserJet400MFPM425dn" | select name | ft -hidetableheaders 

HPLaserJet400MFPM...                      HP Standard TCP/I... HPTCPMON.DLL

Get the printer driver of a specific printer

PS C:\Users\snickers> get-printerdriver -name "HP LaserJet 400 MFP M425 PCL 6"

Remove printer by name

    PS C:\Windows\system32> remove-printer -name "HP LaserJet 400 MFP M425 PCL 6" 

Remove a printer driver by name

PS C:\Users\snickers> remove-printerdriver -name "HP LaserJet 400 MFP M425 PCL 6"

Example of removing printers via PowerShell from ST #98848

 Wed, Sep 23 2015 10:15  Stephen Nickerson commented
Used PowerShell to list existing "printers" on scspc602 (using CS-GENERAL\snickers-adm) 

get-printer -computername scspc602.cs.uwaterloo.ca | select name, drivername, portname 

name                                    drivername                              portname 
----                                    ----------                              -------- 
Xerox WorkCentre 5335 - DC2325          Xerox WorkCentre 5335 V4 PCL6           LPT1: 
Send To OneNote 2013                    Send to Microsoft OneNote 15 Driver     nul: 
scsadmin-dc2325 Xerox WorkCentre 5335   Xerox WorkCentre 5335 V4 PCL6           scsadmin-dc2325.cs.uwaterloo.ca 
Microsoft XPS Document Writer           Microsoft XPS Document Writer v4        PORTPROMPT: 
mfp102.cs -- mail room                  Xerox Global Print Driver PCL           mfp102.cs.uwaterloo.ca:9100 
mfp102.cs                               Xerox Global Print Driver PCL6          print.cs.uwaterloo.ca:631 
MFP102 - CS Office Mail Room            Xerox Global Print Driver PCL           172.19.33.37_1 
mfp102 - CS Mail Room                   Xerox Global Print Driver PCL6          mfp102.cs.uwaterloo.ca:9100 
mfp102                                  Xerox Global Print Driver PCL6          631/printers/mfp102 
Fax                                     Microsoft Shared Fax Driver             SHRFAX: 
DYMO LabelWriter 400                    DYMO LabelWriter 400                    USB001 
Brother QL-550                          Brother QL-550                          USB002 
Adobe PDF                               Adobe PDF Converter                     Documents\*.pdf 

Ran the following PowerShell commands with my CS-GENERAL\snickers-adm account to remove the non-functioning "printers" 
  Remove-Printer -name "mfp102.cs -- mail room" -ComputerName scspc602.cs.uwaterloo.ca 
  Remove-Printer -name "mfp102.cs" -ComputerName scspc602.cs.uwaterloo.ca 
  Remove-Printer -name "mfp102 - CS Mail Room" -ComputerName scspc602.cs.uwaterloo.ca 
  Remove-Printer -name "mfp102" -ComputerName scspc602.cs.uwaterloo.ca 

Verified, via PowerShell, that the non-functioning "printers" were removed from scspc602. 
get-printer -computername scspc602.cs.uwaterloo.ca | select name, drivername, portname 

name                                    drivername                              portname 
----                                    ----------                              -------- 
Xerox WorkCentre 5335 - DC2325          Xerox WorkCentre 5335 V4 PCL6           LPT1: 
Send To OneNote 2013                    Send to Microsoft OneNote 15 Driver     nul: 
scsadmin-dc2325 Xerox WorkCentre 5335   Xerox WorkCentre 5335 V4 PCL6           scsadmin-dc2325.cs.uwaterloo.ca 
Microsoft XPS Document Writer           Microsoft XPS Document Writer v4        PORTPROMPT: 
MFP102 - CS Office Mail Room            Xerox Global Print Driver PCL           172.19.33.37_1 
Fax                                     Microsoft Shared Fax Driver             SHRFAX: 
DYMO LabelWriter 400                    DYMO LabelWriter 400                    USB001 
Brother QL-550                          Brother QL-550                          USB002 
Adobe PDF                               Adobe PDF Converter                     Documents\*.pdf 


Confirmed on Jeannie's PC that MS Office no longer lists the "printers" from failed attempts at setting up the print queues for the PC. 

In the process, found another failed print queue attempt, "Xerox WorkCentre 5335 - DC2325" 
- Jeannie asked for help with a Firefox print problem. 
  - She kept getting an error when trying to print to the networked printer in her office. 
    - The name for the properly working queue for this printer is "scsadmin-dc2325 Xerox WorkCentre 5335" 
- Jeannie can print from Firefox successfully when using the "scsadmin-dc2325 Xerox WorkCentre 5335" printer. 

Removed the non-functioning printer, "Xerox WorkCentre 5335 - DC2325" 
PS C:\Users\TEMP> Remove-Printer -name "Xerox WorkCentre 5335 - DC2325" -ComputerName scspc602.cs.uwaterloo.ca 

Verified, via PowerShell, that the "printer", "Xerox WorkCentre 5335 - DC2325" no longer appears on scspc602. 

PS C:\Users\TEMP> get-printer -computername scspc602.cs.uwaterloo.ca | select name, drivername, portname 

name                                    drivername                              portname 
----                                    ----------                              -------- 
Send To OneNote 2013                    Send to Microsoft OneNote 15 Driver     nul: 
scsadmin-dc2325 Xerox WorkCentre 5335   Xerox WorkCentre 5335 V4 PCL6           scsadmin-dc2325.cs.uwaterloo.ca 
Microsoft XPS Document Writer           Microsoft XPS Document Writer v4        PORTPROMPT: 
MFP102 - CS Office Mail Room            Xerox Global Print Driver PCL           172.19.33.37_1 
Fax                                     Microsoft Shared Fax Driver             SHRFAX: 
DYMO LabelWriter 400                    DYMO LabelWriter 400                    USB001 
Brother QL-550                          Brother QL-550                          USB002 
Adobe PDF                               Adobe PDF Converter                     Documents\*.pdf  |||||
Topic revision: r3 - 2017-07-26 - StephenNickerson
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback