Skip to content

Instantly share code, notes, and snippets.

@macbeth76
Created June 11, 2021 04:55
Show Gist options
  • Select an option

  • Save macbeth76/3fe0d208a6b12513b6e6255637f30431 to your computer and use it in GitHub Desktop.

Select an option

Save macbeth76/3fe0d208a6b12513b6e6255637f30431 to your computer and use it in GitHub Desktop.
$printers = Get-Printer
$xl = New-Object -ComObject Excel.Application
foreach ($printer in $printers) {
(New-Object -ComObject WScript.Network).SetDefaultPrinter($printer.name)
$xl = New-Object -ComObject Excel.Application
$xl.Visible = $false
$xl.ActivePrinter
}
$xl.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment