powershell 将vRA蓝图导出为PowervRA的内容包
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了powershell 将vRA蓝图导出为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
}
以上是关于powershell 将vRA蓝图导出为PowervRA的内容包的主要内容,如果未能解决你的问题,请参考以下文章