I'm trying to make a PowerShell script that will change all the drivers for a specific set of printers.
I have about 200 printers whose name begins with the letter Z.I also have a handful of printers that don't begin with the letter Z.
What i'm trying to accomplish is this... Any printer beginning with the letters ZEB has their driver changed to "HP LaserJet 4000 Series PS"
I've tried modifying the script below to work with what i need, but it just runs and nothing changes.
$driver = "HP LaserJet 4000 Series PS"$pattern = 'ZEB'$printers = gwmi win32_printerforeach($printer in $printers){ $name = $printer.name if($name -like $pattern){& rundll32 printui.dll PrintUIEntry /Xs /n $name DriverName $driver }}