Wednesday, September 18, 2013

Clone a Host Profile with a PowerCLI script

Wow! I just noticed it's been way too long since I posted anything. The stuff I've learned about AutoDeploy, Cisco FlexFlash, and UCS has been piling up...

Here's a note for some folks who asked me about cloning a Host Profile with a PowerCLI script. Thanks to the inimitable LucD for this script, reproduced from the VMware Communities.

$hostProfileName = "MyProfile" $prof = Get-VMHostProfile -Name $hostProfileName 

$profMgr = Get-View HostProfileManager

$spec = New-Object VMware.Vim.HostProfileCompleteConfigSpec $spec.Annotation = $prof.ExtensionData.Config.Annotation
$spec.ApplyProfile = $prof.ExtensionData.Config.ApplyProfile
$spec.CustomComplyProfile = $prof.ExtensionData.Config.CustomComplyProfile
$spec.DisabledExpressionList = $prof.ExtensionData.Config.DisabledExpressionList$spec.Enabled = $prof.ExtensionData.Config.Enabled
$spec.Name = $prof.ExtensionData.Config.Name + " - COPY"


Hope folks find it as useful as I have. 

No comments:

Post a Comment