PowerShell Commands

Add-Printer

Add-Printer [-Name*] <String> [-DriverName*] <String> [-BranchOfficeOfflineLogSizeMB <UInt32>] [-CimSession<CimSession[]>] [-Comment <String>] [-ComputerName <String>] [-Datatype <String>] [-DisableBranchOfficeLogging][-KeepPrintedJobs] [-Location <String>] [-PermissionSDDL <String>] [-PrintProcessor <String>] [-Priority <UInt32>][-Published] [-RenderingMode {SSR | CSR | BranchOffice}] [-SeparatorPageFile <String>] [-Shared] [-ShareName<String>] [-StartTime <UInt32>] [-ThrottleLimit <Int32>] [-UntilTime <UInt32>] -PortName* <String> [-Confirm][-WhatIf] [<CommonParameters>]
Add-Printer [-Name*] <String> [-BranchOfficeOfflineLogSizeMB <UInt32>] [-CimSession <CimSession[]>] [-Comment<String>] [-ComputerName <String>] [-Datatype <String>] [-DeviceURL <String>] [-DeviceUUID <String>][-DisableBranchOfficeLogging] [-KeepPrintedJobs] [-Location <String>] [-PermissionSDDL <String>] [-PrintProcessor<String>] [-Priority <UInt32>] [-Published] [-RenderingMode {SSR | CSR | BranchOffice}] [-SeparatorPageFile<String>] [-Shared] [-ShareName <String>] [-StartTime <UInt32>] [-ThrottleLimit <Int32>] [-UntilTime <UInt32>][-Confirm] [-WhatIf] [<CommonParameters>]
Add-Printer [-ConnectionName*] <String> [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf][<CommonParameters>]

The Add-Printer cmdlet adds a printer to a specified computer. You can add both local printers and connections to network-based printers.

You cannot use wildcard characters with Add-Printer. You can use Add-Printer in a Windows PowerShell remoting session.

You do not need administrative credentials to run Add-Printer.

Parameters

-BranchOfficeOfflineLogSizeMB [<UInt32>]

Specifies the maximum size, in megabytes, of the branch office remote offline log file for this printer. You cannot specify this parameter for unshared queues or queues that do not have branch office enabled.

-CimSession [<CimSession[]>]

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

-Comment [<String>]

Specifies the text to add to the Comment field for the specified printer.

-ComputerName [<String>]

Specifies the name of the computer to which to add the printer.

-ConnectionName <String>

  • This value is required

Specifies the name of a shared printer to which to connect. This parameter is required.

-Datatype [<String>]

Specifies the data type the printer uses to record print jobs.

-DeviceURL [<String>]

Specifies a URL for directed discovery of Web Services on Devices (WSD) printer to add to the specified computer.

-DeviceUUID [<String>]

Specifies the multicast UUID for device detection for the WSD port.

-DisableBranchOfficeLogging [<SwitchParameter>]

Indicates that branch office remote logging is disabled. You cannot specify this parameter for unshared queues.

-DriverName <String>

  • This value is required

Specifies the name of the printer driver for the printer.

-KeepPrintedJobs [<SwitchParameter>]

Specifies whether the print jobs in the queue are kept.

-Location [<String>]

Specifies the location of the printer.

-Name <String>

  • This value is required
  • Accepts pipeline input ByValue

Specifies the name of the printer to add.

-PermissionSDDL [<String>]

Specifies the permissions for the printer as a Security Descriptor Definition Language (SDDL) string.

-PortName <String>

  • This value is required

Specifies the name of the port that is used or created for the printer.

-PrintProcessor [<String>]

Specifies the name of the print processor used by the printer.

-Priority [<UInt32>]

Specifies the relative queue priority.

-Published [<SwitchParameter>]

Specifies whether the printer is published in the network directory service.

-RenderingMode [<RenderingModeEnum>]

Specifies the rendering mode for the printer. You can specify one of the following rendering modes:

-- SSR, Service Side Rendering -- CSR. Client Side Rendering -- BranchOffice. Branch Office

-SeparatorPageFile [<String>]

Specifies the path of and name of the separator page to be used by the printer.

-ShareName [<String>]

Specifies the name by which to share the printer on the network. To share a printer, specify the Shared parameter.

-Shared [<SwitchParameter>]

Indicates whether to share the printer on the network. You can determine the name by which the printer is shared by specifying ShareName. If ShareName is not specified, the name of the printer is used as the share name.

-StartTime [<UInt32>]

Specifies the starting time of printer availability.

-ThrottleLimit [<Int32>]

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShellr calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

-UntilTime [<UInt32>]

Specifies the ending time of printer availability.

-Confirm [<SwitchParameter>]

  • Default value is false

Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.

-WhatIf [<SwitchParameter>]

  • Default value is false

Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Inputs
This cmdlet takes no input objects.
Outputs
This cmdlet produces no output.
Examples
  1. Add a printer to a local computer:
    PS C:\>  Add-Printer -Name "mxdw 2" -DriverName "Microsoft XPS Document Writer v4" -PortName "portprompt:"
    

    This command adds a printer with name mxdw2 to the local computer. The mxdw printer uses the Microsoft XPS Document Writer v4 driver and the portprompt: port.

    The portprompt: port prompts for a file name to save the XPS document when printing to the XPS printer.

  2. Add a new network printer connection:
    PS C:\>  Add-Printer -ConnectionName \\printServer\printerName
    

    This command adds a printer by specifying the name of a print server and a shared printer on that server.

This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.

PowerShell Commands