| |

Microsoft SCVMM and Citrix PVS, exporting retries to a CSV

2 min read

SCVMM

While I’m still experimenting with the Microsoft SCVMM and Citrix PVS PowerShell cmdlets (read more about my first ramblings about this topic here) I figured it’s difficult to get an export of the vDisk usage to track down the number of retries on a vDisk for a particular host so I wrote a little script to make this easier.

 

As said, I’ve been looking for usecases to combine the both PowerShell cmdlets and see how PoSH can improve the manageability of both SCVMM and PVS. 

While I was fiddling around with the PVS console I was looking into usage of the infamous vDisk usage screen:

Screen Shot 2017-06-19 at 14.34.33

 

Although it will give you a lot of useful information it can be slow and there’s no way to export the information from this screen which makes cross referencing VMs with high retries with the hosts they’re running on impossible. 

Back to Powershell ISE with the following plan:

  • Import the right Cmdlets;
  • Connect to the Citrix PVS server and the SCVMM server;
  • Get all VMs in the PVS device collections and grab their names;
  • Loop through all PVS VMs based on the object names and fetch the Hyper-V hostinfo;
  • Combine the info into an easy to modify file format for troubleshooting.

Combining these steps resulted in the below script, it might not be a large and complex script but I guess some people will stilll find it useful:

# Importing the proper modules
if ( (Get-PSSnapin -Registered -Name Citrix.PVS.Snapin -ErrorAction SilentlyContinue) -eq $null )
{
    Add-PsSnapin Citrix.PVS.Snapin
}
Import-Module -Name VirtualMachineManager

# Setting up the tables and datapath
$DataPath = "C:\PVSHost_retries.csv"
$PVSServer = "Citrix-PVS01"
$Results = @()

# Connecting to PVS
Set-PvsConnection -Name $PVSServer

# Get all VMs and the number of retries on the vDisk

$VMs = Get-PvsDevice
foreach ($VM in $VMs) {
        $PVSinfo = Get-PVSDeviceInfo -Name $VM.Name
        $VMMInfo = Get-SCVirtualMachine -Name $VM.Name

        $Properties = @{
        VMHost = $VMMInfo.VMHost
        Name = $PVSinfo.Name
        Retries = $PVSinfo.Status
        }
$Results += New-Object psobject -Property $Properties
}

$Results | Export-Csv -NoTypeInformation -Path $DataPath

Hopefully this will help you getting hosts that are not behaving well causing those pesky retries on the vDisk.

The following two tabs change content below.

Kees Baggerman

Kees Baggerman is Senior Technical Director — Performance & Solutions Engineering R&D at Nutanix, where he leads a global team responsible for defining how enterprise applications are delivered on the Nutanix platform. A former Citrix Technology Professional and NVIDIA Enterprise Platform Advisor, he has spent 15+ years driving EUC strategy and technical direction across architecture, product, and customer success. He has been writing here since 2011 — sharing what he learns at the intersection of platform engineering and enterprise IT.
Kees Baggerman

Kees Baggerman

Senior Technical Director at Nutanix - Former Citrix CTP - NVIDIA Enterprise Platform Advisor - 15+ years in EUC

Kees Baggerman is Senior Technical Director — Performance & Solutions Engineering R&D at Nutanix, where he leads a global team responsible for defining how enterprise applications are delivered on the Nutanix platform. A former Citrix Technology Professional and NVIDIA Enterprise Platform Advisor, he has spent 15+ years driving EUC strategy and technical direction across architecture, product, and customer success. He has been writing here since 2011 — sharing what he learns at the intersection of platform engineering and enterprise IT.

Similar Posts

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.