检测IIS应用程序池对象 回收
生活随笔
收集整理的這篇文章主要介紹了
检测IIS应用程序池对象 回收
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
?
?
function RecycleYourAppPool([string] $poolName){
?
Import-Module WebAdministration
?
#獲取所有Application Pools
?
Write-Host '開始回收IIS應用程序池...'$poolName
?
$appPool =ls IIS:\apppools |Where-Object{$_.name -eq $poolName}
?
if($appPool){
$appPool.Recycle();
}
}
?
RecycleYourAppPool('recyTest')
?
?
?
[Powershell] 檢查IIS設置
$script:OutMessage = "ok"function WriteLog([string] $content){#Write-Host $content$script:OutMessage += $content + "`r`n" }Import-Module WebAdministration#獲取所有Application PoolsWriteLog "開始檢查IIS應用程序池..." Get-ChildItem IIS:\apppools | ForEach-Object{$appPoolName = $_.NameWriteLog("開始檢查應用程序池: " + $_.name)$appPool = $_#檢查回收設置$RecyclingTime = $appPool.recycling.periodicRestart.time.TotalMinutesWriteLog ("--自動回收周期(Minutes):" + $RecyclingTime)#檢查賬號設置$identityType = $appPool.processModel.identityTypeWriteLog("--賬號類型:" + $identityType)$userName = $appPool.processModel.userNameWriteLog("--用戶:" + $userName)#$password = $appPool.processModel.password#生成回收事件日志設置$LogEventOnRecycle = $appPool.recycling.logEventOnRecycleWriteLog("--LogEventOnRecycle:"+ $LogEventOnRecycle)#把Idle Timeout設為0$IdleTimeout = $appPool.processModel.idleTimeoutWriteLog("--IdleTimeout:"+ $IdleTimeout)#最大工作進程數設置為0,支持NUMA$maxProcesses = $appPool.processModel.maxProcessesWriteLog("--maxProcesses:"+ $maxProcesses)WriteLog (" ") }WriteLog "開始檢查IIS網站..." Get-ChildItem IIS:\Sites | ForEach-Object{$site = $_WriteLog ("開始檢查站點: " + $site.name)#檢查網站日志目錄WriteLog ("--是否開啟IISLOG:" + $site.logFile.enabled)WriteLog ("--日志字段:" + $site.logFile.logExtFileFlags)WriteLog ("--日志存放路徑:" + $site.logFile.directory)WriteLog ("--日志文件大小:" + $site.logFile.truncateSize)WriteLog (" ") }$OutMessage?
總結
以上是生活随笔為你收集整理的检测IIS应用程序池对象 回收的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: diamond源码阅读-diamond-
- 下一篇: 大型网站架构系列:分布式消息队列