Skip to content

Resume-PrintJob

Print Management: Resumes a suspended print job.

#Requires -Version 5.1
#Requires -Modules PrintManagement

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$PrinterName,
    [Parameter(Mandatory = $true)]
    [int]$JobID,
    [string]$ComputerName,
    [pscredential]$AccessAccount
)

Process {
    try {
        if ([System.String]::IsNullOrWhiteSpace($ComputerName)) { $ComputerName = [System.Net.DNS]::GetHostByName('').HostName }
        $cim = if ($null -eq $AccessAccount) { New-CimSession -ComputerName $ComputerName -ErrorAction Stop }
               else { New-CimSession -ComputerName $ComputerName -Credential $AccessAccount -ErrorAction Stop }
        Resume-PrintJob -CimSession $cim -ComputerName $ComputerName -PrinterName $PrinterName -ID $JobID -ErrorAction Stop | Out-Null
        Write-Output "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Print job $JobID resumed on printer $PrinterName on $ComputerName"
    }
    catch { throw }
    finally { if ($null -ne $cim) { Remove-CimSession $cim -ErrorAction SilentlyContinue } }
}

Name of the printer on which to resume the print job.

ID of the print job to resume.

Name of the computer on which to resume the print job.

User account that has permission to perform this action.

An interactive directory of PowerShell scripts.