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.processModel.idleTimeout
#最大工作进程数设置为0,支持NUMA
$maxProcesses = $appPool.processModel.maxProcesses
}
WriteLog('[{"IIS application name":{"value":"' + $_.name + '","unit":
Windows巡检IIS指标脚本(PowerShell实现)
最新推荐文章于 2024-06-11 11:24:05 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)