zoukankan      html  css  js  c++  java
  • 检测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 Pools
    
    WriteLog "开始检查IIS应用程序池..."
    Get-ChildItem IIS:apppools | ForEach-Object{
        $appPoolName =  $_.Name
        WriteLog("开始检查应用程序池: " + $_.name)
    
        $appPool = $_
    
        #检查回收设置
        $RecyclingTime = $appPool.recycling.periodicRestart.time.TotalMinutes
        WriteLog ("--自动回收周期(Minutes):" + $RecyclingTime)
    
        #检查账号设置
        $identityType = $appPool.processModel.identityType
        WriteLog("--账号类型:" + $identityType)
    
        $userName = $appPool.processModel.userName
        WriteLog("--用户:" + $userName)
        #$password = $appPool.processModel.password
    
        #生成回收事件日志设置
        $LogEventOnRecycle = $appPool.recycling.logEventOnRecycle
        WriteLog("--LogEventOnRecycle:"+ $LogEventOnRecycle)
    
        #把Idle Timeout设为0
        $IdleTimeout = $appPool.processModel.idleTimeout
        WriteLog("--IdleTimeout:"+ $IdleTimeout)
    
        #最大工作进程数设置为0,支持NUMA
        $maxProcesses = $appPool.processModel.maxProcesses
        WriteLog("--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
    复制代码
  • 相关阅读:
    FZU 2104 Floor problem (水题)
    POJ 1797 Heavy Transportation (最短路变形)
    ZOJ 3708 Density of Power Network (水题)
    POJ 2488 A Knight's Journey (DFS)
    HDU 1198 Farm Irrigation (并查集)
    HDU 1052 Tian Ji -- The Horse Racing (贪心)
    HDU 1598 find the most comfortable road (并查集||最短路)
    poj 2533 Longest Ordered Subsequence(最长上升子序列)
    hdu 2025 查找最大元素 (水)
    hdu 5142 NPY and FFT(水)
  • 原文地址:https://www.cnblogs.com/micro-chen/p/6042917.html
Copyright © 2011-2022 走看看