tacticalrmm/scripts_wip/Win_Printers_Delete_Old_Job...

9 lines
354 B
PowerShell
Raw Normal View History

2021-04-27 17:11:30 +00:00
#Update with command parameters
$PrintJobs = get-wmiobject -class "Win32_PrintJob" -namespace "root\CIMV2" -computername . | Where-Object {[System.Management.ManagementDateTimeConverter]::ToDateTime($_.TimeSubmitted) -lt (Get-Date).AddDays(-2)}
foreach ($job in $PrintJobs)
{
# Write-Host "Canceling job $($job.JobId)"
$job.Delete()
}