haorui658 发表于 2009-11-27 22:05:47

请问这段代码为什么运行不了?

本帖最后由 haorui658 于 2009-12-13 21:03 编辑

$strComputer = "."
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery _
("Select * from Win32_PnPEntity " _
& "WHERE ConfigManagerErrorCode <> 0")

For $objItem in $colItems
ConsoleWrite( "Class GUID: " & $objItem.ClassGuid & @CRLF )
ConsoleWrite( "Description: " & $objItem.Description & @CRLF )
ConsoleWrite( "Device ID: " & $objItem.DeviceID & @CRLF )
ConsoleWrite( "Manufacturer: " & $objItem.Manufacturer & @CRLF )
ConsoleWrite( "Name: " & $objItem.Name & @CRLF )
ConsoleWrite( "PNP Device ID: " & $objItem.PNPDeviceID & @CRLF )
ConsoleWrite( "Service: " & $objItem.Service & @CRLF & @CRLF )
Next

kodin 发表于 2009-11-27 22:38:17

本帖最后由 kodin 于 2009-11-27 23:00 编辑



$objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2")
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_PnPEntity WHERE ConfigManagerErrorCode <> 0')


For $objItem In $colItems
        ConsoleWrite("Class GUID: " & $objItem.ClassGuid & @CRLF)
        ConsoleWrite("Description: " & $objItem.Description & @CRLF)
        ConsoleWrite("Device ID: " & $objItem.DeviceID & @CRLF)
        ConsoleWrite("Manufacturer: " & $objItem.Manufacturer & @CRLF)
        ConsoleWrite("Name: " & $objItem.Name & @CRLF)
        ConsoleWrite("PNP Device ID: " & $objItem.PNPDeviceID & @CRLF)
        ConsoleWrite("Service: " & $objItem.Service & @CRLF & @CRLF)
Next
页: [1]
查看完整版本: 请问这段代码为什么运行不了?