Memory Informationen: Unterschied zwischen den Versionen
Aus Wiki-WebPerfect
Admin (Diskussion | Beiträge) K |
Admin (Diskussion | Beiträge) |
||
Zeile 1: | Zeile 1: | ||
+ | == Plain Memory Info == | ||
+ | <source lang="powershell"> | ||
+ | $MemoryInGB = [math]::Round((Get-Ciminstance Win32_OperatingSystem).TotalVisibleMemorySize/1mb,2) | ||
+ | $MemoryInMB = $MemoryInGB * 1024 | ||
+ | $MemoryInMB | ||
+ | </source> | ||
+ | |||
+ | |||
+ | |||
+ | == Memory Test Funktion == | ||
<source lang="powershell"> | <source lang="powershell"> | ||
Function Test-MemoryUsage { | Function Test-MemoryUsage { |
Version vom 22. September 2017, 15:54 Uhr
Plain Memory Info
$MemoryInGB = [math]::Round((Get-Ciminstance Win32_OperatingSystem).TotalVisibleMemorySize/1mb,2) $MemoryInMB = $MemoryInGB * 1024 $MemoryInMB
Memory Test Funktion
Function Test-MemoryUsage { [cmdletbinding()] Param() $os = Get-Ciminstance Win32_OperatingSystem $pctFree = [math]::Round(($os.FreePhysicalMemory/$os.TotalVisibleMemorySize)*100,2) if ($pctFree -ge 45) { $Status = "OK" } elseif ($pctFree -ge 15 ) { $Status = "Warning" } else { $Status = "Critical" } $os | Select @{Name = "Status";Expression = {$Status}}, @{Name = "PctFree"; Expression = {$pctFree}}, @{Name = "FreeGB";Expression = {[math]::Round($_.FreePhysicalMemory/1mb,2)}}, @{Name = "TotalGB";Expression = {[int]($_.TotalVisibleMemorySize/1mb)}} }
Quelle: https://www.petri.com/display-memory-usage-powershell