<< Back to Script Library

Get Citrix MCS RAM / Disk Cache Usage

Use this script based action to pull detailed information on the cache usage on Citrix XenDesktop 7.9 and above.
Version: 1.0.1
Created: 2016-05-31
Modified: 2016-05-31
Creator: Andrew Morgan
Downloads: 663
Tags: citrix IOPS MCS xenapp xendesktop
The Script Copy Script Copied to clipboard
#Requires -Version 3.0

$availablemem = [math]::Round((Get-counter '\Citrix MCS Storage Driver\Cache memory target size').countersamples[0].cookedvalue / 1mb)
$memused=[math]::Round((Get-counter '\Citrix MCS Storage Driver\Cache memory used').countersamples[0].cookedvalue / 1mb)

$usedmemperc=[math]::Round(($memused / $availablemem) * 100)

$availabledisk=[math]::Round((Get-counter '\Citrix MCS Storage Driver\Cache disk size').countersamples[0].cookedvalue / 1gb,2)
$diskused=[math]::Round((Get-counter '\Citrix MCS Storage Driver\Cache disk used').countersamples[0].cookedvalue / 1gb,2)

$useddiskperc=[math]::Round(($diskused / $availabledisk) * 100)

$Object = New-Object PSObject -Property @{
    "Total Ram Cache (mb)" = $availablemem
    "Used Ram Cache (mb)" = $memused
    "Used Ram Cache (%)" = $usedmemperc
    "Total Disk Cache (gb)" = $availabledisk
    "Used Disk Cache (gb)" = $diskused
    "Used Disk Cache (%)" = $useddiskperc

$object | select  "Used Ram Cache (%)","Used Disk Cache (%)","Total Ram Cache (mb)", "Used Ram Cache (mb)","Total Disk Cache (gb)","Used Disk Cache (gb)"