Windows巡检IIS指标脚本(PowerShell实现)
function WriteLog([string] $content){ #Write-Host $content $script:OutMessage += $content + "`r`n" } Import-Module WebAdministration #获取所有Application Pools #WriteLog "Start checking IIS application pool..." # 开始检查IIS应用程序池 Get-ChildItem IIS:\apppools | ForEach-Object{ $appPoolName = $_.Name $appPool = $_ #检查回收设置 $RecyclingTime = $appPool.recycling.periodicRestart.time.TotalMinutes #检查账号设置 $identityType = $appPool.processModel.identityType $userName = $appPool.processModel.userName #生成回收事件日志设置 $LogEventOnRecycle = $appPool.recycling.logEventOnRecycle #把Idle Timeout设为0 $IdleTimeout = $appPool