Quantcast
Channel: Active questions tagged powershell-3.0 - Stack Overflow
Viewing all articles
Browse latest Browse all 123

PowerShell Script to Change Printer Drivers on Several Printers

$
0
0

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        }}

Viewing all articles
Browse latest Browse all 123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>