PowerShell Commands

Set-Printer

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

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 the Get-Printer cmdlet, 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 credentials to run Set-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 on which the printer is installed.

-Datatype [<String>]

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

-DisableBranchOfficeLogging [<Boolean>]

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

-DriverName [<String>]

Specifies the name of the printer driver for the printer.

-KeepPrintedJobs [<Boolean>]

Specifies whether the printer jobs in the queue are kept.

-Location [<String>]

Specifies the location of the printer.

-Name <String[]>

  • This value is required
  • Accepts pipeline input ByPropertyName

Specifies the name of the printer to modify.

-PassThru [<SwitchParameter>]

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

-PermissionSDDL [<String>]

Specifies the permissions for the printer as an SDDL string.

-PortName [<String>]

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 [<Boolean>]

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

-RenderingMode [<RenderingModeEnum>]

Specifies the rendering mode for the printer. The acceptable values for this parameter are:

-- SSR -- CSR -- BranchOffice

-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 change the share state of a printer, specify the Shared parameter.

-Shared [<Boolean>]

Specifies whether the printer is shared.

-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
Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_Printer
This cmdlet accepts one printer object.
Outputs
Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_Printer
This cmdlet returns a printer object.
Examples
  1. Set printer to keep printed jobs:
    PS C:\>  Set-Printer -Name "Microsoft XPS Document Writer" -KeepPrintedJobs $True
    

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

  2. Set printer to keep printed jobs by using a printer object:
    PS C:\> $Printer = Get-Printer -Name "Microsoft XPS Document Writer"
    PS C:\>  $Printer.KeepPrintedJobs = $True
    PS C:\>  Set-Printer -InputObject $Printer
    

    The first command gets the printer named Microsoft XPS Document Writer by using the Get-Printer cmdlet. The command stores the result in the $Printer variable.

    The second command assigns a value of $True to the KeepPrintedJobs property of the $Printer object.

    The final command sets the value of revised value of $Printer.

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