|
|
@@ -0,0 +1,17 @@
|
|
|
+
|
|
|
+$totalRam = (Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).Sum
|
|
|
+$date = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
|
|
+$cpuTime = (Get-Counter '\Processor(_Total)\% Processor Time').CounterSamples.CookedValue
|
|
|
+$availMem = (Get-Counter '\Memory\Available MBytes').CounterSamples.CookedValue
|
|
|
+[PSCustomObject]@{
|
|
|
+ Hostname = (hostname)
|
|
|
+ Date = $date
|
|
|
+ CPU = $cpuTime
|
|
|
+ Memory = [PSCustomObject]@{
|
|
|
+ Available = $availMem
|
|
|
+ PercentUsage = (100 - (104857600 * $availMem / $totalRam))
|
|
|
+ Total = ($totalRam/1048576)
|
|
|
+ Used = ($totalRam/1048576 )- $availMem
|
|
|
+ Unit = "MB"
|
|
|
+ }
|
|
|
+}
|