Get Pagefile usage of all running VM’s in inventory

Get Pagefile usage of all running VM’s in inventory

function Get-PagefileUsage {
$tabelle = @()
Get-VM | ? {$_.PowerState -like "PoweredOn"} | % { 
   $collect                =   "" | Select Name, PagefileUsage, TotalvRAM
   $collect.Name           =   $_.Name
   $collect.PagefileUsage  =   (Get-WmiObject Win32_PagefileUsage -ComputerName $_.Guest.Hostname).CurrentUsage
   $collect.TotalvRam      =   $_.MemoryMB
   $tabelle += $collect
   }
$tabelle | Export-Csv $env:userprofile\Desktop\PagefileOverview.csv
Write-Host -fore yellow "Tabelle exportiert auf den Desktop als PagefileOverview.csv"
""
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s