Häufige WMI-Abfragen

Hier ein paar typische WMI-Abfragen, z.B. anzuwenden in der WMI-Filterung für Gruppenrichtlinien oder bei der Konfiguration von BGInfo. Kommentare und Erläuterungen in [eckigen Klammern] hinter den jeweiligen Abfragen.

Akku-Status (Notebook)
SELECT * FROM Win32_Battery WHERE EstimatedChargeRemaining > ’20‘  [Restladekapazität >20%]
SELECT EstimatedChargeRemaining FROM Win32_Battery

Datum
SELECT Day AND Month AND Year FROM Win32_CurrentTime
SELECT DayOfWeek FROM Win32_CurrentTime

Bildschirm
SELECT ScreenWidth FROM Win32_DesktopMonitor
SELECT ScreenHeight FROM Win32_DesktopMonitor
SELECT SystemName FROM Win32_DesktopMonitor WHERE ScreenWidth = 1024 AND ScreenHeight = 768  [alle Systeme mit einer Auflösung von 1024×768]
SELECT * FROM Win32_DesktopMonitor WHERE ScreenHeight = 768
SELECT * FROM Win32_DesktopMonitor WHERE ScreenWidth = 1024
SELECT SystemName FROM Win32_DesktopMonitor WHERE DeviceID = ‚DesktopMonitor1‘ AND ScreenWidth > 800 AND ScreenHeight > 600  [ggf. DesktopMonitor2 bei weiteren Bildschirmen]

Routingtabelle
SELECT NextHop FROM Win32_IP4RouteTable  [Abfrage des Gateways]
SELECT Metric1 FROM Win32_IP4RouteTable WHERE NextHop = ‚192.168.1.1‘  [Abfrage der hinterlegten Metrik zum Gateway]
SELECT Destination FROM Win32_IP4PersistedRouteTable  [Fest eingetragene Netzwerke]

Laufwerke
SELECT FileSystem FROM Win32_LogicalDisk

Arbeitsspeicher
SELECT EndingAddress FROM Win32_MemoryDevice  [Verfügbarer RAM in KB]
SELECT Capacity FROM Win32_PhysicalMemory  [Verfügbarer RAM in B]
SELECT MaxCapacity FROM Win32_PhysicalMemoryArray  [Maximal steckbarer RAM in KB]

Netzwerkkarten
SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPenabled = TRUE
SELECT DefaultIPGateway FROM Win32_NetworkAdapterConfiguration WHERE IPenabled = TRUE
SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPenabled = TRUE AND DHCPEnabled = TRUE
SELECT DNSServerSearchOrder FROM Win32_NetworkAdapterConfiguration WHERE IPenabled = TRUE

NT Profil
SELECT FullName FROM Win32_NetworkLoginProfile WHERE UserType = ‚Normal Account‘
oder
SELECT * FROM Win32_NetworkLoginProfile WHERE FullName IS NOT NULL

Domäne / Domain Controller
SELECT * FROM Win32_NTDomain WHERE DomainControllerAddressType IS NOT NULL
SELECT ClientSiteName FROM Win32_NTDomain WHERE ClientSiteName IS NOT NULL
SELECT DcSiteName FROM Win32_NTDomain WHERE DcSiteName IS NOT NULL
SELECT DnsForestname FROM Win32_NTDomain WHERE DnsForestName IS NOT NULL  [Domain Suffix]
SELECT DomainControllerAddress FROM Win32_NTDomain WHERE DomainControllerAddress IS NOT NULL
SELECT DomainControllerName FROM Win32_NTDomain WHERE DomainControllerName IS NOT NULL
SELECT DomainName FROM Win32_NTDomain WHERE DomainName IS NOT NULL  [Domänen-NetBIOS Name]

Betriebssystem
SELECT Caption FROM Win32_OperatingSystem  [OS Anzeigename]
SELECT * FROM Win32_OperatingSystem WHERE Version > ‚6.0‘  [Alle Windowssysteme mit einer OS-Version > 6.0]
SELECT BuildNumber FROM Win32_OperatingSystem
SELECT * FROM Win32_OperatingSystem WHERE OSArchitecture = ’64-Bit‘ [Alle 64bit Systeme]

Festplatte
SELECT SerialNumber FROM Win32_PhysicalMedia  [Seriennummer der Festplatten]

Drucker
SELECT * FROM Win32_Printer WHERE DriverName = ‚Druckerfreigabename‘

Prozessor
SELECT AddressWidth FROM Win32_Processor  [= 32 or 64 bit]
SELECT Name FROM Win32_Processor

Dienste
SELECT * FROM Win32_Service WHERE State = ‚Running‘  [Alle Dienste im Status ‚Gestartet‘]
SELECT * FROM Win32_Service WHERE Name = ‚Dnscache‘  [DNS-Client Dienst]

Social tagging:

Schreibe einen Kommentar


4 + = neun

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.