Add modules from WinAPI (process managment and cim hardware)
This commit is contained in:
parent
3514ec6e3d
commit
bbfdb5d61f
11 changed files with 243 additions and 0 deletions
15
Scripts/Get-MemorySize.psm1
Normal file
15
Scripts/Get-MemorySize.psm1
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
function Get-MemorySize {
|
||||
$Memory = Get-CimInstance Win32_OperatingSystem
|
||||
$MemUse = $Memory.TotalVisibleMemorySize - $Memory.FreePhysicalMemory
|
||||
$GetProcess = Get-Process
|
||||
$ws = ((($GetProcess).WorkingSet | Measure-Object -Sum).Sum/1gb).ToString("0.00 GB")
|
||||
$pm = ((($GetProcess).PM | Measure-Object -Sum).Sum/1gb).ToString("0.00 GB")
|
||||
$CollectionMemory = New-Object System.Collections.Generic.List[System.Object]
|
||||
$CollectionMemory.Add([PSCustomObject]@{
|
||||
MemoryAll = ($memory.TotalVisibleMemorySize/1mb).ToString("0.00 GB")
|
||||
MemoryUse = ($MemUse/1mb).ToString("0.00 GB")
|
||||
WorkingSet = $ws
|
||||
PageMemory = $pm
|
||||
})
|
||||
$CollectionMemory
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue