Skip to content

Commit

Permalink
Create Monitor-Memory-Usage.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
rswio authored Jan 26, 2025
1 parent 5de4987 commit c3aaa1b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Monitoring/Monitor-Memory-Usage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$Servers = @("Server1", "Server2") # Replace with server names
foreach ($Server in $Servers) {
$Memory = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Server
$UsedMemory = $Memory.TotalVisibleMemorySize - $Memory.FreePhysicalMemory
Write-Output "Memory usage on $Server: $($UsedMemory / $Memory.TotalVisibleMemorySize * 100)%."
}

0 comments on commit c3aaa1b

Please sign in to comment.