Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for login_disconnect_network_printer.ps

(view source code of login_disconnect_network_printer.ps as plain text)

  1. $oldErrorActionPreference = $ErrorActionPreference
  2. $ErrorActionPreference = 'SilentlyContinue'
  3. Get-Printer -Name 'LaserJet Marketing' | Remove-Printer
  4. # Check if removal succeeded
  5. if ( Get-Printer -Name 'LaserJet marketing' ) {
  6. 	Write-Host "Failed to remove 'LaserJet Marketing' printer"
  7. }
  8. $ErrorActionPreference = $oldErrorActionPreference

page last uploaded: 2021-01-27