如:$strComputer = "."
$objWMIService = ObjGet("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & $strComputer & "\root\cimv2")
$colServices = $objWMIService.ExecQuery _
("SELECT * FROM Win32_Service WHERE Name = 'MSSQLServer'")
If $colServices.Count > 0 Then
For $objService in $colServices
ConsoleWrite("SQL Server is " & objService.State & ".")
Next
Else
ConsoleWrite("SQL Server is not installed on this computer.")
EndIf
提示 $colServices = $objWMIService.ExecQuery _
("SELECT * FROM Win32_Service WHERE Name = 'MSSQLServer'")
有问题, 如果则在安装了sql server 200x的机器执行,则没有任何问题。
因为提示这句查询出来为空值,而autoit不知道如何处理?
而问大家一句,遇到这种情况,应该如何判断?
[ 本帖最后由 fjchenq 于 2009-4-8 11:16 编辑 ] |