Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get-process command giving negative value while monitoring process on a remote computer

Tags:

powershell

I am executing this command on my system

get-process $Processname -computername $Computername 

but in output its giving me negative Working set and Paged memory size value output:

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

Plz let me know the ways to comeover this issue.. For those who do not understand what I mean no need to to burst out plz as I am explaining it more.. Initially I am doing something like this:

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}

}  

After that I am running the following command:

get-process $Processname -computername $Computername  | format-table   $a -wrap
like image 888
Abhishek_Mishra Avatar asked Jun 07 '12 14:06

Abhishek_Mishra


1 Answers

Try the following --

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

Your bitness check should be removed and you should only used the 64-bit properties. The old properties are obselete. Source

like image 71
pk. Avatar answered Oct 29 '22 02:10

pk.