查看SQL状态的vbs
程序员文章站
2022-04-10 08:04:51
复制代码 代码如下:'**************************** '*by r05e '*检验sql server是否在这机器上工作 '***********...
复制代码 代码如下:
'****************************
'*by r05e
'*检验sql server是否在这机器上工作
'****************************
strcomputer = "."
set objwmiservice = getobject("winmgmts:" _
& "{impersonationlevel=impersonate}!\\" & strcomputer & "\root\cimv2")
set colservices = objwmiservice.execquery _
("select * from win32_service where name = 'mssqlserver'")
if colservices.count > 0 then
for each objservice in colservices
wscript.echo "sql server is " & objservice.state & "."
next
else
wscript.echo "sql server is not installed on this computer."
end if
上一篇: 批量文件查找替换功能的vbs脚本
下一篇: VbScript 封裝MS OWC(二)