大网数据广告活动
Windows 系统接口

Win32_PrinterDriver class

· 52CE 我爱测

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

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

The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties, but excludes methods. For reference information about methods, see the table of methods in this topic.

Syntax

class Win32_PrinterDriver : CIM_Service
{
  string   Caption;
  string   ConfigFile;
  string   CreationClassName;
  string   DataFile;
  string   DefaultDataType;
  string   DependentFiles[];
  string   Description;
  string   DriverPath;
  string   FilePath;
  string   HelpFile;
  string   InfName;
  datetime InstallDate;
  string   MonitorName;
  string   Name;
  string   OEMUrl;
  boolean  Started;
  string   StartMode;
  string   Status;
  string   SupportedPlatform;
  string   SystemCreationClassName;
  string   SystemName;
  uint16   Version;
};

Members

The Win32_PrinterDriver class has these types of members:

Methods

The Win32_PrinterDriver class has these methods.

Method Description
AddPrinterDriver Creates a new printer driver.
StartService Starts print service.
StopService Stops print service.

Properties

The Win32_PrinterDriver class has these properties.

Caption

Data type: string

Access type: Read-only

Qualifiers: MaxLen (64), DisplayName ("Caption")

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

This property is inherited from CIM_ManagedSystemElement.

ConfigFile

Data type: string

Access type: Read-only

Configuration file for this printer driver.

Example: "pscrptui.dll"

CreationClassName

Data type: string

Access type: Read-only

Qualifiers: CIM_Key, DisplayName ("Class Name")

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.

This property is inherited from CIM_Service.

DataFile

Data type: string

Access type: Read-only

Qualifiers: ModelCorrespondence (CIM_DataFile.FileName)

Data file for this printer driver.

Example: "qms810.ppd"

DefaultDataType

Data type: string

Access type: Read-only

Default data type for this printer driver.

Example: "EMF"

DependentFiles

Data type: string array

Access type: Read-only

Array of dependent files for this printer driver.

Description

Data type: string

Access type: Read-only

Qualifiers: DisplayName ("Description")

Comment that describes the link.

This property is inherited from CIM_ManagedSystemElement.

DriverPath

Data type: string

Access type: Read-only

Qualifiers: ModelCorrespondence (CIM_DataFile.Path)

Path for this printer driver.

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

FilePath

Data type: string

Access type: Read/write

Path to the INF file being used.

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

HelpFile

Data type: string

Access type: Read-only

Help file for this printer driver.

Example: "pscrptui.hlp"

InfName

Data type: string

Access type: Read/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.

InstallDate

Data type: datetime

Access type: Read-only

Qualifiers: MappingStrings ("MIF.DMTF|ComponentID|001.5"), DisplayName ("Install Date")

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

This property is inherited from CIM_ManagedSystemElement.

MonitorName

Data type: string

Access type: Read-only

Name of the monitor for this printer driver.

Example: "PJL monitor"

Name

Data type: string

Access type: Read-only

Qualifiers: Key

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

This property is inherited from CIM_ManagedSystemElement and overrides the Name definition in that class.

OEMUrl

Data type: string

Access type: Read-only

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.

Started

Data type: boolean

Access type: Read-only

Qualifiers: DisplayName ("Started")

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

This property is inherited from CIM_Service.

StartMode

Data type: string

Access type: Read-only

Qualifiers: DisplayName ("Start Mode")

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

This property is inherited from CIM_Service.

The following are possible values:

"Automatic" "Manual"

Automatic ("Automatic")

Manual ("Manual")

Status

Data type: string

Access type: Read-only

Qualifiers: MaxLen (10), DisplayName ("Status")

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.

This property is inherited from CIM_ManagedSystemElement.

Values include the following:

OK ("OK")

Error ("Error")

Degraded ("Degraded")

Unknown ("Unknown")

Pred Fail ("Pred Fail")

Starting ("Starting")

Stopping ("Stopping")

Service ("Service")

Stressed ("Stressed")

NonRecover ("NonRecover")

No Contact ("No Contact")

Lost Comm ("Lost Comm")

SupportedPlatform

Data type: string

Access type: Read/write

Operating environments that the driver is intended for.

Example: "Windows NT x86".

SystemCreationClassName

Data type: string

Access type: Read-only

Qualifiers: Propagated ("CIM_System.CreationClassName"), CIM_Key, DisplayName ("System Class Name")

Scoping system's creation class name.

This property is inherited from CIM_Service.

SystemName

Data type: string

Access type: Read-only

Qualifiers: Propagated ("CIM_System.Name"), CIM_Key, DisplayName ("System Name")

Name of the system that hosts this service.

This property is inherited from CIM_Service.

Version

Data type: uint16

Access type: Read/write

Operating system version for the printer driver.

3

Win2k

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.

Examples

See Print driver installation from print server.

The following VBScript sample lists all the printer drivers that have been installed on a computer.

strComputer = "." 
Set objWMIService = GetObject("winmgmts:" _ 
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
Set colInstalledPrinters =  objWMIService.ExecQuery _ 
    ("Select * from Win32_PrinterDriver") 
 
For each objPrinter in colInstalledPrinters 
    Wscript.Echo "Configuration File: " & objPrinter.ConfigFile 
    Wscript.Echo "Data File: " & objPrinter.DataFile 
    Wscript.Echo "Description: " & objPrinter.Description 
    Wscript.Echo "Driver Path: " & objPrinter.DriverPath 
    Wscript.Echo "File Path: " & objPrinter.FilePath 
    Wscript.Echo "Help File: " & objPrinter.HelpFile 
    Wscript.Echo "INF Name: " & objPrinter.InfName 
    Wscript.Echo "Monitor Name: " & objPrinter.MonitorName 
    Wscript.Echo "Name: " & objPrinter.Name 
    Wscript.Echo "OEM Url: " & objPrinter.OEMUrl 
    Wscript.Echo "Supported Platform: " & objPrinter.SupportedPlatform 
    Wscript.Echo "Version: " & objPrinter.Version 
Next 

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Namespace Root\CIMV2
MOF Win32_Printer.mof
DLL CIMWin32.dll

See also

CIM_Service

Computer System Hardware Classes

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。