WMI

出自 ProgWiki
前往: 導覽搜尋

WMI(Windows Management Instrumentation)

相關網站

相關工具

應用

  • Script resources for IT professionals
 http://gallery.technet.microsoft.com/ScriptCenter/site/search/?f[0].Type=Tag&f[0].Value=WMI

自動移除離線的印表機

set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
set sInstalledPrinters = objWMIService.ExecQuery ("Select * from Win32_Printer where ExtendedPrinterStatus = 7")
For Each sPrinter in sInstalledPrinters
 sPrinter.Delete
Next

列舉Process.Name

Set objServices = GetObject( "winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy}!root/cimv2")
set objProcessSet = objServices.ExecQuery ("SELECT Name FROM Win32_Process",,48)
For Each Process in objProcessSet
    WScript.Echo Process.Name
Next

電腦硬体狀態

使用Microsoft WMI Scripting Library取得BIOS狀態