Home > Software design >  Remove-printer -Name - How to remove multiple printers in powershell?
Remove-printer -Name - How to remove multiple printers in powershell?

Time:10-05

I cannot find a way to remove multiple printers using this comand:

Remove-printer -Name "Name"

I've already tried with:

Remove-printer -Name "Name,Name1,Name2"
Remove-printer -Name "Name|Name1|Name2"

Is there a way to remove multiple printers using only one command? Thanks

CodePudding user response:

the cmdlet remove-printer supports an array for the parameter name, so you can do:

#Define Array
$names = @('name1','name2','name3')
#Remove printer
remove-printer -name $names
  • Related