Powershell: Return Virtual Machines from PernixData FVP Blacklist

It’s a long time since my last blog post.  So it’s good to be back. In mean time we deployed PernixData FVP and it was fun to play with the Powershell module. 

You can import the PernixData FVP module installed on the PernixData FVP management server via:

Import-Module PrnxCli

This post is not about the Powershell module or how it works. You can check the following post by Byron Schaller.

In this post I want to share a Powershell script that can be used to report all the virtual machines currently added to the PernixData FVP blacklist.

The script below returns all the PernixData FVP clusters and for each cluster it will check the if there are virtual machines added to the Blacklist. If this is true, the script will return those virtual machines.

Import-Module PrnxCli Connect-PrnxServer <PRNXSERVER> $prnxVmBlacklistInfo = @() foreach ($fvpCluster in (Get-PrnxObject -Type FlashCluster | Sort-Object Name)) { Write-Host "Measuring Pernix FVP Cluster: $($fvpCluster.Name)" -ForegroundColor Yellow $BlacklistVMs = Get-PrnxObject -Cluster $fvpCluster.Name -Type "VM" | Where-Object {($_ | Get-PrnxAccelerationPolicy).CachePolicy -eq "Blacklisted"} foreach($vm in $BlacklistVMs){ $BlacklistInfo = New-Object PSObject -Property ([ordered]@{ FVPCluster = $fvpCluster.Name TotalFVPBlacklistVMs = $BlacklistVMs.Count VM = $vm.Name }) $prnxVmBlacklistInfo += $BlacklistInfo } }





$timestamp = get-date -Format HH-mm-ss-dd-MM-yyyy $csv = $env:TEMP + $timestamp + "_PernixDataFVP_Blacklist.CSV" $prnxVmBlacklistInfo | Export-CSV -NoTypeInformation -UseCulture -Path $csv Disconnect-PrnxServer

The script exports the information gathered by the script to a CSV file inside the TEMP directory.