Export vRA blueprints as content packages with PowervRA
#requires -version 5
<#
- Export vRA Blueprint content package and extract the archive
- Requires PowerShell 5
#>
# --- Set Filter
$Filter = "CentOS*"
# --- Get blueprints
$Blueprints = Get-vRABlueprint -Verbose | Where-Object {$_.Name -like $Filter}
# --- Create a content package for each blueprint in $Blueprints
$Blueprints | ForEach-Object {
New-vRAContentPackage -BlueprintId $_.Id -Name "$($_.Name)" -Description "Content package for blueprint $($_.Name)" -Verbose | Out-Null
}
# --- Get content packages
$ContentPackages = Get-vRAContentPackage -Verbose | Where-Object {$_.Name -like $Filter}
# --- Export each content package to the current directory
$ContentPackages | ForEach-Object {
$File = Export-vRAContentPackage -Id $_.Id -File "$($_.Name).zip" -Verbose
# --- Unzip
$Destination = "$($File.DirectoryName)\$($File.BaseName)"
Expand-Archive -Path $File.FullName -DestinationPath $Destination -Verbose
Remove-Item -Path $File.FullName -Force -Verbose
}