Files

8 lines
375 B
PowerShell

$Printername = Get-Printer | Where-Object { $_.Type -like "*Local*" -and $_.Name -notlike "*OneNote*" -and $_.Name -notlike "*Fax*" -and $_.Name -notlike "*Microsoft*" }
$Printername | ForEach-Object {
Remove-Printer -Name $_.Name -Confirm:$false -Verbose
}
$Printers = Get-Printer | Select-Object -ExpandProperty Name
Write-Host "Remaining printers:"
Write-Output $Printers