/build/static/layout/Breadcrumb_cap_w.png

I Can See Clearly Now Checking Video Settings with PowerShell

Video drivers and display configuration issues can be a real head-ache. Especially when troubleshooting a remote problem. Wouldn't it be handy to check an end-user's display configuration and video setup without a trip to their desktop? Don't you think there should be an easier way to "see" Figure 1?

Figure 1 Typical Display Resolution Configuration

Using Windows Management Instrumentation (WMI) is the answer. And since you are running Windows 7 we'll use Windows PowerShell to make it even easier.

The first class we'll look at is Win32_VideoController.

PS C:\> get-wmiobject win32_videocontroller –comp Win7-22


__GENUS                      : 2
__CLASS                      : Win32_VideoController
__SUPERCLASS                 : CIM_PCVideoController
__DYNASTY                    : CIM_ManagedSystemElement
__RELPATH                    : Win32_VideoController.DeviceID="VideoCon...
__PROPERTY_COUNT             : 59
__DERIVATION                 : {CIM_PCVideoController, CIM_VideoControll...
__SERVER                     : WIN7-22
__NAMESPACE                  : root\cimv2
__PATH                       : \\WIN7-22\root\cimv2:Win32_VideoControlle...
AcceleratorCapabilities      :
AdapterCompatibility         : NVIDIA
AdapterDACType               : Integrated RAMDAC
AdapterRAM                   : 1073741824
Availability                 : 3
CapabilityDescriptions       :
Caption                      : NVIDIA GeForce GTS 360M
ColorTableEntries            :
ConfigManagerErrorCode       : 0
ConfigManagerUserConfig      : False
CreationClassName            : Win32_VideoController
CurrentBitsPerPixel          : 32
CurrentHorizontalResolution  : 1600
CurrentNumberOfColors        : 4294967296
CurrentNumberOfColumns       : 0
CurrentNumberOfRows          : 0
CurrentRefreshRate           : 60
CurrentScanMode              : 4
CurrentVerticalResolution    : 900
Description                  : NVIDIA GeForce GTS 360M
DeviceID                     : VideoController1
DeviceSpecificPens           :
DitherType                   : 0
DriverDate                   : 20101016000000.000000-000
DriverVersion                : 8.17.12.6099
ErrorCleared                 :
ErrorDescription             :
ICMIntent                    :
ICMMethod                    :
InfFilename                  : oem50.inf
InfSection                   : Section002
InstallDate                  :
InstalledDisplayDrivers      : nvd3dumx.dll,nvwgf2umx.dll,nvwgf2umx.dll,...
LastErrorCode                :
MaxMemorySupported           :
MaxNumberControlled          :
MaxRefreshRate               : 60
MinRefreshRate               : 60
Monochrome                   : False
Name                         : NVIDIA GeForce GTS 360M
NumberOfColorPlanes          :
NumberOfVideoPages           :
PNPDeviceID                  : PCI\VEN_10DE&DEV;_0CB1&SUBSYS;_FF501179&REV...PowerManagementCapabilities;  :
PowerManagementSupported     :
ProtocolSupported            :
ReservedSystemPaletteEntries :
SpecificationVersion         :
Status                       : OK
StatusInfo                   :
SystemCreationClassName      : Win32_ComputerSystem
SystemName                   : WIN7-22
SystemPaletteEntries         :
TimeOfLastReset              :
VideoArchitecture            : 5
VideoMemoryType              : 2
VideoMode                    :
VideoModeDescription         : 1600 x 900 x 4294967296 colors
VideoProcessor               : GeForce GTS 360M
I connected to the computer Win7-22 and I can see it is running an NVIDIA card at 1600x900. I can also check the driver version and compare this to the latest version. A more succinct approach might be something like:
PS C:\> get-wmiobject win32_videocontroller –comp win7-22 | Select VideoProcessor,VideoModeDescription,CurrentBitsPerPixel,Driver*,CurrentRefreshRate


VideoProcessor       : GeForce GTS 360M
VideoModeDescription : 1600 x 900 x 4294967296 colors
CurrentBitsPerPixel  : 32
DriverDate           : 20101016000000.000000-000
DriverVersion        : 8.17.12.6099
CurrentRefreshRate   : 60

You can learn more about this class at http://msdn.microsoft.com/en-us/library/aa394137(VS.85).aspx. For pre-Vista operating systems you can query the Win32_DisplayConfiguration class. It actually wouldn't be too hard to remotely query all your desktops and build a report showing video configuration and driver information.

On a per machine level, you can also find related WMI information such as the plug and play device. If you've done WMI scripting you may be familiar with the Associators Of query. While you can do that type of query in PowerShell there is a much easier way. First we get the video controller.

$v=get-wmiobject win32_videocontroller –comp win7-22

Then we'll invoke the GetRelated() method. Although all we're interested in is the Win32_PnPEntity class.

$v.getrelated() | where {$_.__CLASS -match "PnPEntity"}  | select Name,Manufacturer,Service

Name                                    Manufacturer                Service
----                                    ------------                -------
NVIDIA GeForce GTS 360M                 NVIDIA                     nvlddmkm

Once we know the service, we can query that as well using the Win32_SystemDriver class.

PS C:\> get-wmiobject win32_systemdriver -filter "name='nvlddmkm'" –comp win7-22 | select *


Status                  : OK
Name                    : nvlddmkm
State                   : Running
ExitCode                : 0
Started                 : True
ServiceSpecificExitCode : 0
__GENUS                 : 2
__CLASS                 : Win32_SystemDriver
__SUPERCLASS            : Win32_BaseService
__DYNASTY               : CIM_ManagedSystemElement
__RELPATH               : Win32_SystemDriver.Name="nvlddmkm"
__PROPERTY_COUNT        : 22
__DERIVATION            : {Win32_BaseService, CIM_Service, CIM_LogicalEl...
__SERVER                : WIN7-22
__NAMESPACE             : root\cimv2
__PATH                  : \\WIN7-22\root\cimv2:Win32_SystemDriver.Name...
AcceptPause             : False
AcceptStop              : True
Caption                 : nvlddmkm
CreationClassName       : Win32_SystemDriver
Description             : nvlddmkm
DesktopInteract         : False
DisplayName             : nvlddmkm
ErrorControl            : Ignore
InstallDate             :
PathName                : C:\Windows\system32\DRIVERS\nvlddmkm.sys
ServiceType             : Kernel Driver
StartMode               : Manual
StartName               :
SystemCreationClassName : Win32_ComputerSystem
SystemName              : WIN7-22
TagId                   : 3
Scope                   : System.Management.ManagementScope
Path                    : \\WIN7-22\root\cimv2:Win32_SystemDriver.Name=...
Options                 : System.Management.ObjectGetOptions
ClassPath               : \\WIN7-22\root\cimv2:Win32_SystemDriver
Properties              : {AcceptPause, AcceptStop, Caption, CreationCla...
SystemProperties        : {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY...}
Qualifiers              : {dynamic, Locale, provider, UUID}
Site                    :
Container               :

Other classes you might want to check out include Win32_DesktopMonitor, assuming your hardware is relatively new and supports the Windows Display Driver Model.

This isn't difficult and I'm not writing any scripts. How do you keep tabs on display details as well as other devices on all of your servers and desktops?


Comments

This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ