Citrix Powertools Get-MachineCatalog-VM-Snapshot

1 min read
Citrix Powertools Get-MachineCatalog-VM-Snapshot
When you want to know what image all your Citrix Machine Catalogs are running.

Powertools

Its time to begin the Citrix Powertools series. A set of Powershell based scripts to simplify managing a Citrix site and unlocking its hidden features.

Get-MachineCatalog-VM-Snapshot

💡
As with most Powertools this does assume you have a location of C:\Support available.

Today we’ll give a look at Get-MachineCatalog-VM-Snapshot.

A picture is worth a thousand words. Here you can see you’ll enter a delivery controller name and the results will show all of your Machine Catalogs that use MCS, the VM name and the snapshot in use.

Powershell code

#------intro-----

Clear-Host
Write-Host "------- " -NoNewLine
Write-Host "Citrix PowerTools" -NoNewLine
Write-Host " -------"
Write-Host ""
Write-Host "Get Machine Catalog > VM > Snapshot" -ForegroundColor Yellow
$site = Read-Host "Enter delivery controller for site"


#------do thing-----

Add-PsSnapin Citrix*
Get-ProvScheme -AdminAddress $site | select ProvisioningSchemeName,@{n='MasterVM';e={$_.MasterImageVM -replace 'XDHyp:\\HostingUnits\\[^\\]+\\([^\\]+)\.vm\\.*$' , '$1' }},@{n='Snapshot';e={$_.MasterImageVM -replace '^.*\\([^\\]+)\.snapshot$' , '$1' }} | Format-Table -AutoSize | Out-File C:\Support\Report.txt -Force
$Report = Get-Content "C:\Support\Report.txt"
$Report2 = $Report.replace('ProvisioningSchemeName','Machine Catalog').replace("MasterVM","`tvSphere VM")
$siteName = (Get-BrokerSite -AdminAddress $site).name 


#------results-----

Clear-Host
Write-Host "------- " -NoNewLine
Write-Host "Citrix PowerTools" -NoNewLine
Write-Host " -------"
Write-Host ""
Write-Host "Results for site: $siteName" -ForegroundColor cyan
Write-Host "Delivery controller checked: $site" -ForegroundColor yellow
$Report2
pause

Lets see how many tools we can put together.

Virtualize Brief


Follow