Win32_PrinterDriver

Win32 Printer Driver
root/cimv2key : Name

The Win32_PrinterDriver WMI class represents the drivers for a Win32_Printer instance.

On this page

Main example

List instances

# All instances of Win32_PrinterDriver, with the main properties
Get-CimInstance -ClassName Win32_PrinterDriver |
    Select-Object -Property Name, Description, Status, Version, StartMode, InstallDate

Examples

Filter with WQL

# WQL filter evaluated by the provider: only the instances where Started is TRUE
Get-CimInstance -ClassName Win32_PrinterDriver -Filter 'Started = TRUE' |
    Select-Object -Property Name, Description, Status, Version, StartMode, InstallDate

The filter is evaluated by the WMI provider: less data is transferred than with Where-Object.

Query a remote computer (CIM session)

review before running
# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
    Get-CimInstance -CimSession $cimSession -ClassName Win32_PrinterDriver |
        Select-Object -Property Name, Description, Status, Version, StartMode, InstallDate
} finally {
    Remove-CimSession -CimSession $cimSession
}

WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.

Show the class structure

# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName Win32_PrinterDriver
$cimClass.CimClassProperties |
    Select-Object -Property Name, CimType, Flags

# Methods of the class
$cimClass.CimClassMethods |
    Select-Object -Property Name, ReturnType

Properties

22 of 22 properties
NameTypeAccessDescription
Captionstringread

Short description of the object—a one-line string.

Code
# Value of Caption for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, Caption |
    Select-Object -Property Name, Caption
ConfigFilestringread

Configuration file for this printer driver.

Example: "pscrptui.dll"

Code
# Value of ConfigFile for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, ConfigFile |
    Select-Object -Property Name, ConfigFile
CreationClassName keystringread

Name of the class or the subclass used in the creation of an instance. When used with the other key properties of this class, this property allows all instances of this class and its subclasses to be uniquely identified.

Code
# Value of CreationClassName for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, CreationClassName |
    Select-Object -Property Name, CreationClassName
DataFilestringread

Data file for this printer driver.

Example: "qms810.ppd"

Code
# Value of DataFile for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, DataFile |
    Select-Object -Property Name, DataFile
DefaultDataTypestringread

Default data type for this printer driver.

Example: "EMF"

Code
# Value of DefaultDataType for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, DefaultDataType |
    Select-Object -Property Name, DefaultDataType
DependentFilesstring[]read

Array of dependent files for this printer driver.

Code
# Value of DependentFiles for each instance
# DependentFiles is an array: -ExpandProperty returns its items one by one
Get-CimInstance -ClassName Win32_PrinterDriver -Property DependentFiles |
    Select-Object -ExpandProperty DependentFiles
Descriptionstringread

Comment that describes the link.

Code
# Value of Description for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, Description |
    Select-Object -Property Name, Description
DriverPathstringread

Path for this printer driver.

Example: "C:\\drivers\\pscript.dll"

Code
# Value of DriverPath for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, DriverPath |
    Select-Object -Property Name, DriverPath
FilePathstringread/write

Path to the INF file being used.

Example: "c:\\temp\\driver"

Code
# Value of FilePath for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, FilePath |
    Select-Object -Property Name, FilePath

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes FilePath on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_PrinterDriver -Filter "Name = 'Example'"
$setParameters = @{
    InputObject = $instance
    Property    = @{ FilePath = 'Example' }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
HelpFilestringread

Help file for this printer driver.

Example: "pscrptui.hlp"

Code
# Value of HelpFile for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, HelpFile |
    Select-Object -Property Name, HelpFile
InfNamestringread/write

Name of the INF file being used. The default is to use an operating system provided printer INF file. A different file name is used if the driver is provided directly by the manufacturer of the printer and not the operating system.

Code
# Value of InfName for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, InfName |
    Select-Object -Property Name, InfName

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes InfName on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_PrinterDriver -Filter "Name = 'Example'"
$setParameters = @{
    InputObject = $instance
    Property    = @{ InfName = 'Example' }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
InstallDatedatetimeread

Date and time the object is installed. This property does not require a value to indicate that the object is installed.

Code
# Value of InstallDate for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, InstallDate |
    Select-Object -Property Name, InstallDate
MonitorNamestringread

Name of the monitor for this printer driver.

Example: "PJL monitor"

Code
# Value of MonitorName for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, MonitorName |
    Select-Object -Property Name, MonitorName
Name keystringread

Driver name for this printer. This is a compound key composed of the Name, Version, and SupportedPlatform values.

Code
# Value of Name for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name |
    Select-Object -Property Name
OEMUrlstringread

World Wide Web (WWW) link to the printer manufacturer's website. Note that this property is not populated when the Win32.inf file is used, and is only applicable for drivers provided directly from the manufacturer.

Code
# Value of OEMUrl for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, OEMUrl |
    Select-Object -Property Name, OEMUrl
Startedbooleanread

If TRUE, the service is started. If FALSE, the service is stopped.

Code
# Value of Started for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, Started |
    Select-Object -Property Name, Started
StartModestringread

Start mode of the service is automatically started by an operating system, or only started when requested.

The following are possible values:

"Automatic"

"Manual"

Values (2)
ValueLabelDescription
AutomaticAutomatic
ManualManual
Code
# Value of StartMode for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, StartMode |
    Select-Object -Property Name, StartMode
Statusstringread

Current status of the object. Various operational and nonoperational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard disk drive, may be functioning properly but predicting a failure in the near future). Nonoperational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", can apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states.

Values include the following:

Values (12)
ValueLabelDescription
OKOK
ErrorError
DegradedDegraded
UnknownUnknown
Pred FailPred Fail
StartingStarting
StoppingStopping
ServiceService
StressedStressed
NonRecoverNonRecover
No ContactNo Contact
Lost CommLost Comm
Code
# Value of Status for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, Status |
    Select-Object -Property Name, Status
SupportedPlatformstringread/write

Operating environments that the driver is intended for.

Example: "Windows NT x86".

Code
# Value of SupportedPlatform for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, SupportedPlatform |
    Select-Object -Property Name, SupportedPlatform

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes SupportedPlatform on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_PrinterDriver -Filter "Name = 'Example'"
$setParameters = @{
    InputObject = $instance
    Property    = @{ SupportedPlatform = 'Example' }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters
SystemCreationClassName keystringread

Scoping system's creation class name.

Code
# Value of SystemCreationClassName for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, SystemCreationClassName |
    Select-Object -Property Name, SystemCreationClassName
SystemName keystringread

Name of the system that hosts this service.

Code
# Value of SystemName for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, SystemName |
    Select-Object -Property Name, SystemName
Versionuint16read/write

Operating system version for the printer driver.

Values (1)
ValueLabelDescription
3Win2k
Code
# Value of Version for each instance
Get-CimInstance -ClassName Win32_PrinterDriver -Property Name, Version |
    Select-Object -Property Name, Version

Warning. Changes the system: check with -WhatIf first. An elevated console is often required.

# Warning: changes Version on the instance. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_PrinterDriver -Filter "Name = 'Example'"
$setParameters = @{
    InputObject = $instance
    Property    = @{ Version = 0 }
    WhatIf      = $true  # Remove this line to actually apply the change
}
Set-CimInstance @setParameters

Methods

AddPrinterDriver #

Creates a new printer driver.

uint32 AddPrinterDriver([in] Win32_PrinterDriver DriverInfo);

Parameters

ParameterTypeDirectionDescription
DriverInfoWin32_PrinterDriverin

An instance of the Win32_PrinterDriver class that represents the printer driver.

Return values

ValueLabelDescription
0Success.
5Access denied.
87The parameter is incorrect. May occur when the object is not correctly filled or when driver cannot be found in the system. Alternately, the name attribute may be different than the model specified in the .inf file. Or, there may be a missing backslash ("\") on a PathFile attribute.
1797The printer driver is unknown.

Call the AddPrinterDriver method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_PrinterDriver -Filter "Name = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'AddPrinterDriver'
    Arguments   = @{ DriverInfo = $null }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'Success'
        5 = 'Access denied'
        87 = 'The parameter is incorrect'
        1797 = 'The printer driver is unknown'
    }
    $returnValueName[[int]$result.ReturnValue]
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

StartService #

Starts print service.

uint32 StartService();

Return values

ValueLabelDescription
0Service successfully started.
1Request not supported.

Call the StartService method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_PrinterDriver -Filter "Name = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'StartService'
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'Service successfully started'
        1 = 'Request not supported'
    }
    $returnValueName[[int]$result.ReturnValue]
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

StopService #

Stops print service.

uint32 StopService();

Return values

ValueLabelDescription
0Service successfully stopped.
1Request not supported.

Call the StopService method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_PrinterDriver -Filter "Name = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'StopService'
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $returnValueName = @{
        0 = 'Service successfully stopped'
        1 = 'Request not supported'
    }
    $returnValueName[[int]$result.ReturnValue]
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Remarks

The Win32_PrinterDriver class is derived from CIM_Service which derives from CIM_LogicalElement.

Users can uninstall a printer driver by deleting a corresponding instance of this class. To do so, the calling process must have the SeLoadDriverPrivilege privilege set to delete an instance of this class.

Inheritance

Superclass chain

  1. CIM_ManagedSystemElement
  2. CIM_LogicalElement
  3. CIM_Service
  4. Win32_PrinterDriver

Known subclasses

No known subclass.

Requirements

Namespace
root/cimv2
Minimum client
Windows Vista
Minimum server
Windows Server 2008
MOF file
Win32_Printer.mof
DLL
CIMWin32.dll

Microsoft source

Source: Microsoft Learn

Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.