Advertisement
Wasif_Hasan_

MemoryMonitor.ps1

Sep 10th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function MemoryMonitor() {
  2. clear-host;$slots=0;$arrays=0
  3. Get-WMIObject -Query "SELECT * FROM Win32_PhysicalMemoryArray WHERE Use=3" | Foreach {$slots += $_.MemoryDevices; $arrays += 1}
  4. $arrays2=Get-WMIObject Win32_PhysicalMemoryArray | Format-Table @{n='Total Memory Slots';e={$slots}},@{n='Memory Arrays';e={$arrays}}
  5. $aboutRAM=Get-WMIObject Win32_PhysicalMemory | Select-Object Caption,Description,@{n='Capacity';e={"$([math]::Round($_.Capacity/1GB)) GB"}},BankLabel,@{n='Device Locator';e={$_.DeviceLocator}},Manufacturer,@{n='Memory Type';e={switch($_.MemoryType){1{"Other"};2{"DRAM"};3{"Synchronus RAM"};4{"Cache RAM"};5{"EDO"};6{"EDRAM"};7{"VRAM"};8{"SRAM"};9{"RAM"};10{"ROM"};11{"Flash"};12{"EEPROM"};13{"FEPROM"};14{"EPROM"};15{"CDRAM"};16{"3DRAM"};17{"SDRAM"};18{"SGRAM"};19{"RDRAM"};20{"DDR"};21{"DDR2"};24{"DDR3"}}}},@{n='Form Factor';e={switch($_.FormFactor){1{"Other"};2{"SIP"};3{"DIP"};4{"ZIP"};5{"SOJ"};6{"Proprietary"};7{"SIMM"};8{"DIMM"};9{"TSOP"};10{"PGA"};11{"RIMM"};12{"SODIMM"};13{"SRIMM"};14{"SMD"};15{"SSMP"};16{"QFP"};17{"TQFP"};18{"SOIC"};19{"LCC"};20{"PLCC"};21{"BGA"};22{"FPBGA"};23{"LGA"}}}},Model,@{n='Speed';e={"$($_.Speed) MHz"}}
  6. "`n##########################################"
  7. "Slots and memory arrays"
  8. "##########################################"
  9. $arrays2
  10. "`n##########################################"
  11. "About your RAM"
  12. "##########################################"
  13. $aboutRAM
  14. "`n##########################################"
  15. "Real time usage info"
  16. "##########################################"
  17. $RUInfo=Get-WMIObject Win32_PerfFormattedData_PerfOS_Memory | Format-Table @{n='Free memory';e={"$($_.AvailableMBytes) MB"}},@{n='Used memory';e={"$([Math]::Round((Get-WMIObject Win32_PhysicalMemory | Select-Object -ExpandProperty Capacity)/1MB)-$_.AvailableMBytes) MB"}},@{n='Commit limit';e={"$([Math]::Round($_.CommitLimit/1MB)) MB"}},@{n='Committed memory';e={"$([Math]::Round($_.CommittedBytes/1MB)) MB"}},@{n='Paged pool';e={"$([Math]::Round($_.PoolPagedBytes/1MB)) MB"}},@{n='Non-paged pool';e={"$([Math]::Round($_.PoolNonpagedBytes/1MB)) MB"}}
  18. $RUInfo;"`n"
  19. $msg=@'
  20. 1) Pause
  21. 2) Go back
  22. 3) Immediate refresh
  23.  
  24. Enter number
  25. '@
  26. choice /c 123 /n /m $msg /t 2 /d 3
  27. switch($LastExitCode){
  28. 1{cmd /c pause;MemoryMonitor}
  29. 2{$r}
  30. 3{MemoryMonitor}
  31. }
  32. }
  33. MemoryMonitor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement