wordpress   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了windows – 用于监视App池内存使用情况的免费应用程序或脚本大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我想要一个显示以下内容的应用程序或脚本: 工作进程,应用程序池名称,内存使用情况以及可选的cpu使用情况. 我熟悉使用 %windir%\system32\inetsrv\appcmd.exe list wp 但这只是获取了workerproces id和app pool名称.然后我接受并交叉引用任务管理器.这是有效的,但我想要一个更快 – 几乎仪表板显示信息.我想必须有某种解决方案来显示信息,而
我想要一个显示以下内容的应用程序或脚本:
工作进程,应用程序池@L_607_3@,内存使用情况以及可选的cpu使用情况.
我熟悉使用

但这只是获取了workerproces id和app pool@L_607_3@.然后我接受并交叉引用任务管理器.这是有效的,但我想要一个更快 – 几乎仪表板显示信息.我想必须有某种解决方案来显示信息,而不需要像过程浏览器那样点击.有人特别喜欢他们使用的东西吗?在PowerShell中这是可能的吗?

如果您没有IIS 7和提供程序,则可以使用WMI.附加脚本适用于大多数需求,cpu使用率除外.将以下脚本保存为get-webserverapppoolstats.ps1(或任何您想要的).

您可以使用以下命令运行脚本:

./Get-WebServerAppPoolStats.ps1’Server1′,’Server2′,’Server3′-IntegratedAuthentication
要么
Get-Content servers.txt | ./Get-WebServerAppPoolStats.ps1-IntegratedAuthentication

param (
    $webserver = $null,$username,$password,[switch]$IntegratedAuthentication)

BEGIN
{
    $path = $MyInvocation.MyCommand.Path

    if ($webserver -ne $null)
    {
        if ($IntegratedAuthentication)
        {
            $webserver | &$path -IntegratedAuthentication
        }
        else
        {
            $webserver | &$path -username $username -password $password
        }
    }
    $OFS = ','
    $Fields = 'CommandLine','Name','CreationDate','ProcessID','WorkingSetSize','ThReadCount','PageFileUsage','PageFaults' 

    $query = @"
    SELEct $fields
    From Win32_Process
    Where name = 'w3wp.exe'
"@

    $AppPool =  @{name='Application Pool';Expression={($_.commandlinE).split(' ')[-1]}}
    $Process = @{name='Process';Expression={$_.namE}}
    $RunningSince = @{name='Running since';Expression={[System.Management.ManagementdatetiR_761_11845@econverter]::TodatetiR_761_11845@e($_.creationdatE)}}
    $Memory = @{name='Memory Used';Expression={'{0:#,#}' -f $_.WorkingSetSizE}}
    $Threads = @{name='Thread Count';Expression={$_.thReadCount}}
    $PageFile = @{name='Page File Size';Expression={'{0:#,#}' -f $_.pagefileusagE}}
    $PageFaults = @{name='Page Faults';Expression={'{0:#,#}' -f $_.pagefaults}} 
}

PROCESS
{
    $server = $_ 

    if ($server -ne $null)
    {
        if ($IntegratedAuthentication)
        {   
            $result = Get-WmiObject -Query $query -ComputerName $server
        }
        else
        {
            $securepassword = ConvertTo-SecureString $password -AsPlaintext -Force
            $cred = New-Object System.Management.Automation.PSCredential -ArgumentList $username,$securepassword

            $result = Get-WmiObject -Query $query -ComputerName $server -Credential $cred 

        }
        $Server = @{name='Server';Expression={$server}}
        $result | SELEct-Object $Server,$AppPool,$Process,$RunningSince,$Memory,$Threads,$PageFile,$pageFaults
    }
}

大佬总结

以上是大佬教程为你收集整理的windows – 用于监视App池内存使用情况的免费应用程序或脚本全部内容,希望文章能够帮你解决windows – 用于监视App池内存使用情况的免费应用程序或脚本所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。