I am unable to find a script that works with vSphere 5.0 which can export the XML customization specifications. GetCustomizationSpec seems to be an unsupported method with PowerCLI 5.0.
Export:
------
# Variables
$VCServer = "vcserver.yourdomain.local"
$path = "."
#Connect to vCenter Server
$VC = Connect-VIServer $VCServer
#Export Customization Profiles
$view = get-view CustomizationSpecManager
ForEach ($CustomizationProfile in $view.info) {
$xml = $view.CustomizationSpecItemToXml($view.GetCustomizationSpec($CustomizationProfile.name))
$xml | Out-File ($path + "\" + ($CustomizationProfile.name) + ".xml")
}
Import:
-----
# Variables
$VCServer = "vcserver.yourdomain.local"
$path = "."
#Connect to vCenter Server
$VC = Connect-VIServer $VCServer
#Import Customization Profiles
$view = Get-View CustomizationSpecManager
ForEach ($xmlfile in (Get-ChildItem -Path $path | where {$_.extension -eq ".xml"})) {
$xml = Get-Content ($xmlfile)
$view.CreateCustomizationSpec($view.XmlToCustomizationSpecItem($xml))
}
Works for me.
The GetCustomizationSpec method is present.
Which PowerCLI build are you using ?
Get-PowerCLIVersion
And did you both export/import the customization spec in vSphere 5 ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hmm this is weird...I closed the PowerCLI window, reconnected, and it works now. Ugh!
Very strange, that shouldn't normally happen.
If you see the same occurring, I would suggest to open a ticket with VMware.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference