6

我在我的系统上执行这个命令

get-process $Processname -computername $Computername 

但在输出中它给了我负工作集和分页内存大小值输出:

Name        ID         VM   PeakVM          WS         PeakWS Thread     Handle
----        --         --   ------          --         ------ ------     ------
FusionA  10724      -1282     -988       -1777          -1697    232       2085
FusionA  10724      -1281     -988       -1746          -1697    232       2091
FusionA  10724      -1280     -988       -1713          -1697    232       2099
FusionA  10724      -1279     -988       -1707          -1697    232       2108
FusionA  10724      -1277     -988       -1702          -1697    232       2118

请让我知道解决这个问题的方法。对于那些不明白我的意思的人,当我在解释更多内容时,无需大声疾呼。最初我正​​在做这样的事情:

if($env:Processor_Architecture -eq "x86")
{
write "`nrunning on 32bit"
$a = @{Expression={$_.Name.SubString(0,7)};Label="Name";width=7}, `
@{Expression={$_.ID};Label="ID";width=6}, `
@{Expression={$_.PagedMemorySize/1024};Label="VirtualMemory";width=10},
@{Expression={$_.PeakPagedMemorySize/1024};Label="PeakVirtualMemory";width=8},
@{Expression={$_.WS/1024};Label="WorkingSet";width=11},
@{Expression={$_.PeakWorkingSet/1024};Label="PeakWorkingSet";width=14},
@{Expression={$_.threads.count};Label="Threads";width=6},
@{Expression={$_.Handles};Label="Handles";width=10}

}
else
{
write "`nrunning on 64bit"
$a = @{Expression={$_.Name.SubString(0,7)};Label="Name";width=7}, `
@{Expression={$_.ID};Label="ID";width=6}, `
@{Expression={$_.PagedMemorySize64/1024};Label="VirtualMemory";width=10},
@{Expression={$_.PeakPagedMemorySize64/1024};Label="PeakVirtualMemory";width=10},
@{Expression={$_.WorkingSet64/1024};Label="WorkingSet";width=11},
@{Expression={$_.PeakWorkingSet64/1024};Label="PeakWorkingSet";width=14},
@{Expression={$_.threads.count};Label="Threads";width=6},
@{Expression={$_.Handles};Label="Handles";width=10}

}  

之后,我运行以下命令:

get-process $Processname -computername $Computername  | format-table   $a -wrap
4

1 回答 1

7

试试下面的——

get-process $Processname -computername $Computername | ft Name,ID,VirtualMemorySize64,PeakVirtualMemorySize64,WorkingSet64,PeakWorkingSet64

应该删除您的位数检查,并且您应该只使用 64 位属性。旧属性已过时。来源

于 2012-06-07T16:18:34.650 回答