Set-Printer

Set-Printer

Updates the configuration of an existing printer.

Syntax

Parameter Set: Name
Set-Printer [-Name] <String> [-AsJob] [-CimSession <CimSession> ] [-Comment <String> ] [-ComputerName <String> ] [-Datatype <String> ] [-DriverName <String> ] [-KeepPrintedJobs <Boolean> ] [-Location <String> ] [-PassThru] [-PermissionSDDL <String> ] [-PortName <String> ] [-PrintProcessor <String> ] [-Priority <UInt32> ] [-Published <Boolean> ] [-RenderingMode <RenderingModeEnum> ] [-SeparatorPageFile <String> ] [-Shared <Boolean> ] [-ShareName <String> ] [-StartTime <UInt32> ] [-ThrottleLimit <Int32> ] [-UntilTime <UInt32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: __cmdletization_InputObject
Set-Printer -InputObject <CimInstance> [-AsJob] [-CimSession <CimSession> ] [-Comment <String> ] [-Datatype <String> ] [-DriverName <String> ] [-KeepPrintedJobs <Boolean> ] [-Location <String> ] [-PassThru] [-PermissionSDDL <String> ] [-PortName <String> ] [-PrintProcessor <String> ] [-Priority <UInt32> ] [-Published <Boolean> ] [-RenderingMode <RenderingModeEnum> ] [-SeparatorPageFile <String> ] [-Shared <Boolean> ] [-ShareName <String> ] [-StartTime <UInt32> ] [-ThrottleLimit <Int32> ] [-UntilTime <UInt32> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Set-Printer cmdlet updates the configuration of the specified printer.

Use the KeepPrintedJobs parameter to make a printer keep printed jobs.

You can specify the printer to update by using either a printer object retrieved by Get-Printer, or by specifying a printer name.

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

You need administrator privileges to use Set-Printer.

Parameters

-AsJob

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Comment<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ComputerName<String>

Specifies the name of the computer on which the printer is installed.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Datatype<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DriverName<String>

Specifies the name of the printer driver for the printer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InputObject<CimInstance>

Specifies the object which contains the printer information to update.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-KeepPrintedJobs<Boolean>

Specifies whether the printer jobs in the queue are kept.

Aliases

none

Required?

false

Position?

named

Default Value

False

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Location<String>

Specifies the location of the printer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of the printer to modify.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-PassThru

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PermissionSDDL<String>

Specifies the permissions for the printer as an SDDL string.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PortName<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PrintProcessor<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Priority<UInt32>

Specifies the relative queue priority.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Published<Boolean>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RenderingMode<RenderingModeEnum>

Specifies the rendering mode for the printer. You can specify one of the following three rendering modes: SSR, CSR, or BOPD

Aliases

none

Required?

false

Position?

named

Default Value

CSR

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SeparatorPageFile<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ShareName<String>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Shared<Boolean>

Changes the share state of the printer.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-StartTime<UInt32>

Specifies the starting time of printer availability.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UntilTime<UInt32>

Specifies the ending time of printer availability.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

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

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_Printer

    This cmdlet accepts one printer object.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_Printer

    This cmdlet returns a printer object.

Examples

-------------------------- ExampleXAMPLE 1: Set printer to keep printed jobs -------------------------- xample: Set printer to keep printed jobs

This command configures the "Microsoft XPS Document Writer" printer to keep printed jobs.

PS C:\> Set-Printer –Name "Microsoft XPS Document Writer" -KeepPrintedJobs $true

Example 2: Set printer to keep printed jobs by using a printer object

This set of commands retrieves a printer object in to a variable ($printer) using Get-Printer, and passes the contents of the variable to Set-Printer.

PS C:\> $printer = Get-Printer –Name "Microsoft XPS Document Writer"
PS C:\> $printer.KeepPrintedJobs = $true
PS C:\> Set-Printer –InputObject $printer

Add-Printer

Get-Printer

Remove-Printer

Rename-Printer