Skip to content

Instantly share code, notes, and snippets.

@directionforward
Last active April 13, 2023 15:24
Show Gist options
  • Save directionforward/9aeec572b24591146d9c4988d10dc2de to your computer and use it in GitHub Desktop.
Save directionforward/9aeec572b24591146d9c4988d10dc2de to your computer and use it in GitHub Desktop.
Change print default to B&W for all printers using Powershell
$action = New-ScheduledTaskAction -Execute "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Argument "&{ echo 'Setting print defaults to BandW...'; `$Printers = Get-Printer; Foreach(`$Printer in `$Printers){Set-PrintConfiguration -PrinterName `$Printer.name -Color `$False}; }";
$trigger = New-ScheduledTaskTrigger -AtStartup;
$trigger.Repetition = (New-ScheduledTaskTrigger -Once -At 12am -RepetitionInterval (New-TimeSpan -Minutes 60)).repetition;
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -DontStopIfGoingOnBatteries -AllowStartIfOnBatteries;
$settings.CimInstanceProperties.Item('MultipleInstances').Value = 3;
$principal = $principal = New-ScheduledTaskPrincipal -UserID "NT AUTHORITY\SYSTEM" -LogonType ServiceAccount -RunLevel Highest;
$task = New-ScheduledTask -Trigger $trigger -Action $action -Settings $settings -Principal $principal;
Register-ScheduledTask "Update printer settings" -InputObject $task;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment