【发布时间】:2016-08-25 18:19:02
【问题描述】:
我的网站将doAppInitAfterRestart 设置为true 并且正在运行,但我想知道应用程序何时完成初始化。
有没有办法通过powershell和WMI知道网站的应用初始化什么时候完成?
【问题讨论】:
标签: powershell iis wmi iis-6
我的网站将doAppInitAfterRestart 设置为true 并且正在运行,但我想知道应用程序何时完成初始化。
有没有办法通过powershell和WMI知道网站的应用初始化什么时候完成?
【问题讨论】:
标签: powershell iis wmi iis-6
试试下面提到的 VB 脚本代码。我已经从我的一个工作脚本中抓取了这段代码,如果您发现任何错误,请发表评论。
iis_con= "localhost"
set WMI_IIS = GetObject( "IIS://" & iis_con & "/W3SVC" )
if WMI_IIS.count = 0 then
' do nothing
else
for each objitem in WMI_IIS
if objitem.class = "IIsWebServer" then
Select Case objItem.serverstate
Case 1: wscript.echo("Starting")
Case 2: wscript.echo("Running")
Case 3: wscript.echo("Stopping")
Case 4: wscript.echo("Stopped")
Case 5: wscript.echo("Pausing")
Case 6: wscript.echo("Paused")
Case 7: wscript.echo("Continuing")
Case Default: wscript.echo("Unknown")
End Select
Next
end if
【讨论】: