Modify Mass Printers with Powershell

Posted on 2011-10-10
Last Modified: 2012-05-12
I am in need of modifying the print drivers used by about 30 printers on a Windows 2008r2 print server. I can go into each manually and choose a different driver, but I am hoping to use a powershell to automate this process so that when vendors provide updated drivers, the process will go much easier.

I have the following PS out there to retrieve Printer info, but I can't figure out how to change the driver used.

$strComputer = "."

$colItems = get-wmiobject -class "Win32_Printer" -namespace "root\CIMV2" `
-computername $strComputer

foreach ($objItem in $colItems) {
	If ($objItem.Name -eq "PRINTER_NAME") {
      write-host "Attributes: " $objItem.Attributes
      write-host "Availability: " $objItem.Availability
      write-host "Caption: " $objItem.Caption
      write-host "Character Sets Supported: " $objItem.CharSetsSupported
      write-host "Comment: " $objItem.Comment
      write-host "Default: " $objItem.Default
      write-host "Description: " $objItem.Description
      write-host "Driver Name: " $objItem.DriverName
      write-host "Enable BIDI: " $objItem.EnableBIDI
      write-host "Error Cleared: " $objItem.ErrorCleared
      write-host "Error Description: " $objItem.ErrorDescription
      write-host "Error Information: " $objItem.ErrorInformation
      write-host "Extended Detected Error State: " $objItem.ExtendedDetectedErrorState
      write-host "Extended Printer Status: " $objItem.ExtendedPrinterStatus
      write-host "Last Error Code: " $objItem.LastErrorCode
      write-host "Local: " $objItem.Local
      write-host "Location: " $objItem.Location
      write-host "Name: " $objItem.Name
      write-host "Network: " $objItem.Network
      write-host "Port Name: " $objItem.PortName
      write-host "Printer State: " $objItem.PrinterState
      write-host "Printer Status: " $objItem.PrinterStatus
      write-host "Queued: " $objItem.Queued
      write-host "Server Name: " $objItem.ServerName
      write-host "Shared: " $objItem.Shared
      write-host "Share Name: " $objItem.ShareName
      write-host "Spool Enabled: " $objItem.SpoolEnabled
      write-host "Status: " $objItem.Status
      write-host "Status Information: " $objItem.StatusInfo

Open in new window

Question by:theacerbic1
    LVL 11

    Expert Comment

    You'll have to use Win32_PrinterDriver class.
    It contains a "AddPrinterDriver()" method which should be used to specify path.

    Author Comment

    From my understanding this will add a new printer driver to the system, but what I need is the ability to assign the new driver to existing queues already configured on the server.

    i.e. Manually you open Print Management, expand to printers, go to the Advanced tab and choose a different driver.

    Will this work for that process as well? I just don't want to update 200 print queues manually.
    LVL 26

    Accepted Solution


    Author Closing Comment

    This resolved part of the issue, but not the root issue

    Featured Post

    Want to promote your upcoming event?

    Attending an event? Speaking at a conference? Or exhibiting at a tradeshow? Easily inform your contacts by using a promotional banner in your email signature. This will ensure your organization’s most important contacts are in the know.

    Join & Write a Comment

    How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
    Set OWA language and time zone in Exchange for individuals, all users or per database.
    This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
    This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now