(view source code of login_disconnect_network_printer.ps as plain text)
$oldErrorActionPreference = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
Get-Printer -Name 'LaserJet Marketing' | Remove-Printer
# Check if removal succeeded
if ( Get-Printer -Name 'LaserJet marketing' ) {
Write-Host "Failed to remove 'LaserJet Marketing' printer"
}
$ErrorActionPreference = $oldErrorActionPreference
page last modified: 2023-03-10