Edit

Share via


Add-Printer

Adds a printer to the specified computer.

Syntax

connection

Add-Printer
    [-ConnectionName] <String>
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ap

Add-Printer
    [-Name] <String>
    [-Comment <String>]
    [-Datatype <String>]
    [-UntilTime <UInt32>]
    [-KeepPrintedJobs]
    [-Location <String>]
    [-SeparatorPageFile <String>]
    [-ComputerName <String>]
    [-Shared]
    [-ShareName <String>]
    [-StartTime <UInt32>]
    [-PermissionSDDL <String>]
    [-PrintProcessor <String>]
    [-Priority <UInt32>]
    [-Published]
    [-RenderingMode <RenderingModeEnum>]
    [-DisableBranchOfficeLogging]
    [-BranchOfficeOfflineLogSizeMB <UInt32>]
    [-WorkflowPolicy <WorkflowPolicyEnum>]
    [-DeviceURL <String>]
    [-DeviceUUID <String>]
    [-IppURL <String>]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

port

Add-Printer
    [-DriverName] <String>
    [-Name] <String>
    -PortName <String>
    [-Comment <String>]
    [-Datatype <String>]
    [-UntilTime <UInt32>]
    [-KeepPrintedJobs]
    [-Location <String>]
    [-SeparatorPageFile <String>]
    [-ComputerName <String>]
    [-Shared]
    [-ShareName <String>]
    [-StartTime <UInt32>]
    [-PermissionSDDL <String>]
    [-PrintProcessor <String>]
    [-Priority <UInt32>]
    [-Published]
    [-RenderingMode <RenderingModeEnum>]
    [-DisableBranchOfficeLogging]
    [-BranchOfficeOfflineLogSizeMB <UInt32>]
    [-WorkflowPolicy <WorkflowPolicyEnum>]
    [-CimSession <CimSession[]>]
    [-ThrottleLimit <Int32>]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

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 may need administrative credentials to run Add-Printer.

Examples

Example 1: Add a printer to a local computer

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.

Example 2: Add a new network printer connection

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.

Parameters

-AsJob

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-BranchOfficeOfflineLogSizeMB

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.

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-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.

Parameter properties

Type:

CimSession[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:Session

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Comment

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ComputerName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:CN

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ConnectionName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

connection
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Datatype

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DeviceURL

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DeviceUUID

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisableBranchOfficeLogging

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DriverName

Specifies the name of the printer driver for the printer.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

port
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IppURL

Specifies a URL or hostname or IP address for the directed discovery of an IPP (Internet Printing Protocol) printer to add to the specified computer.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KeepPrintedJobs

Specifies whether the print jobs in the queue are kept.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Location

Specifies the location of the printer.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of the printer to add.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False
port
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-PermissionSDDL

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PortName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

port
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PrintProcessor

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Priority

Specifies the relative queue priority.

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Published

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-RenderingMode

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

Parameter properties

Type:RenderingModeEnum
Default value:None
Accepted values:SSR, CSR, BranchOffice
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SeparatorPageFile

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Shared

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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ShareName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StartTime

Specifies the starting time of printer availability.

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ThrottleLimit

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 PowerShell® 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.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-UntilTime

Specifies the ending time of printer availability.

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WorkflowPolicy

Enables an administrator to associate a given printer with a specific Workflow application. This parameter does not allow the administrator to override the device-app association that was made using the device metadata service.

Parameter properties

Type:WorkflowPolicyEnum
Default value:None
Accepted values:Uninitialized, Disabled, Enabled
Supports wildcards:False
DontShow:False

Parameter sets

ap
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
port
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

Outputs

Object

Notes

  • The WhatIf switch doesn't work if the ConnectionName parameter set is used.