Last active
April 13, 2023 15:24
-
-
Save directionforward/9aeec572b24591146d9c4988d10dc2de to your computer and use it in GitHub Desktop.
Change print default to B&W for all printers using Powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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