Powershell Script to remove printers and drivers
Before relying on old VBS scripts, it pays to check what native PowerShell tools you have available:

PS&gt; help printer

Name                              Category  Module                    Synopsis
----                              --------  ------                    --------
Add-Printer                       Function  PrintManagement           Adds a printer to the specified computer.
Add-PrinterDriver                 Function  PrintManagement           Installs a printer driver on the specified computer.
Add-PrinterPort                   Function  PrintManagement           Installs a printer port on the specified computer.
Get-Printer                       Function  PrintManagement           Retrieves a list of printers installed on a computer.
Get-PrinterDriver                 Function  PrintManagement           Retrieves the list of printer drivers installed on the specified computer.
Get-PrinterPort                   Function  PrintManagement           Retrieves a list of printer ports installed on the specified computer.
Get-PrinterProperty               Function  PrintManagement           Retrieves printer properties for the specified printer.
Read-PrinterNfcTag                Function  PrintManagement           Reads information about printers from an NFC tag.
Remove-Printer                    Function  PrintManagement           Removes a printer from the specified computer.
Remove-PrinterDriver              Function  PrintManagement           Deletes printer driver from the specified computer.
Remove-PrinterPort                Function  PrintManagement           Removes the specified printer port from the specified computer.
Rename-Printer                    Function  PrintManagement           Renames the specified printer.
Set-Printer                       Function  PrintManagement           Updates the configuration of an existing printer.
Set-PrinterProperty               Function  PrintManagement           Modifies the printer properties for the specified printer.
Write-PrinterNfcTag               Function  PrintManagement           Writes printer connection data to an NFC tag.
Out-Printer                       Cmdlet    Microsoft.PowerShell.U... Sends output to a printer.


So your script reduces to something like this:

$PrintersToRemove = @("Printer1", "Printer2")
$PrintDriversToRemove = @("Manufacturer1", "Manufacturer2")

Remove-Printer -Name $PrintersToRemove -WhatIf

$drivers = Get-PrinterDriver | ? Manufacturer -in $PrintDriversToRemove

foreach ($driver in $drivers)
{
    Remove-PrinterDriver -Name $driver.Name -WhatIf
}


Note that I didn't put in the removing excess printer driver logic. I'm not exactly sure what that does.

Note also the -WhatIf parameters. They stop the commands from actually executing. You would remove those when you are satisfied that the script will do what you want it to do.

Instead of putting comments at the top of the script, you can use the PowerShell help system:

&lt;#
.SYNOPSIS
  Remove old printers by name

.DESCRIPTION
  [Add stuff here if you like.]

.PARAMETER PrintersToRemove
  (REQUIRED) An array of printers to cycle through and
  remove. Use the exact name of the printer to have it included in the list

.PARAMETER PrintDriversToRemove - (optional) An array of printer drivers to cycle
  through and remove. You can obtain a list by running the "prndrvr.vbs -l"
  command on a computer with drivers to remove. Alternatively, you can
  leave the array empty, and the script will remove any unused (determined
  by the system) print drivers automatically.

.NOTES
  Written by Luke Barone

.EXAMPLE
  Example 1

.EXAMPLE 
  Example 2
#&gt;


That way you can do a help MyScript -detail

It's probably a good idea to use parameters to the script rather than getting people to edit it:

[CmdletBinding()]
param(
    [Parameter(Mandatory=$true)]
    [string[]]$PrintersToRemove,

    [Parameter(Mandatory=$false)]
    [string[]]$PrintDriversToRemove
    )


That way if you update the script, you can just copy it over the old one. The users don't have to merge them. You would make another script that contains the actual parameters, and that one would call this one.

One last thing, I like to put the following near the top of my scripts. It helps to avoid some bugs.

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'