Im trying to export some powered off VM's to move between environments, and when i run the export-vm command i get an error. When i run the same command on a machine with the older version of powercli (5.5 release 2) it exports fine. Im running the commands against a vcenter 6.5 environment. I have tried the new powercli from several machines with the same results. I dont know if theres a bug in the export command, or if something has changed in the syntax. Any help would be appreciated.
PS C:\Windows\system32> get-vm VM_Name|export-vm -destination d:\
export-vm : 5/29/2019 3:50:12 PM Export-VApp An error occurred while sending the request.
At line:1 char:24
+ get-vm VM_Name|export-vm -destination d:\
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Export-VApp], ViError
+ FullyQualifiedErrorId : Client20_NfcLease_RunNfcTask_Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.ExportVA
pp
Heres what i have installed
PS C:\Windows\system32> Get-Module -Name VMware* -ListAvailable
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 6.7.0.1... VMware.DeployAutomation {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-D...
Script 6.7.0.1... VMware.ImageBuilder {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-Esx...
Manifest 11.2.0.... VMware.PowerCLI
Script 6.7.0.1... VMware.Vim
Script 11.2.0.... VMware.VimAutomation.Cis.Core {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script 11.0.0.... VMware.VimAutomation.Cloud {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, G...
Script 11.2.0.... VMware.VimAutomation.Common
Script 11.2.0.... VMware.VimAutomation.Core {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAd...
Script 11.2.0.... VMware.VimAutomation.Hcx {Connect-HCXServer, Disconnect-HCXServer, Get-HCXAppliance...
Script 7.6.0.1... VMware.VimAutomation.HorizonView {Connect-HVServer, Disconnect-HVServer}
Script 10.0.0.... VMware.VimAutomation.License Get-LicenseDataManager
Script 11.2.0.... VMware.VimAutomation.Nsxt {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtPolicy...
Script 11.2.0.... VMware.VimAutomation.Sdk {Get-ErrorReport, Get-InstallPath, Get-PSVersion}
Script 11.0.0.... VMware.VimAutomation.Security {Get-SecurityInfo, Get-VTpm, Get-VTpmCertificate, Get-VTpm...
Script 11.2.0.... VMware.VimAutomation.Srm {Connect-SrmServer, Disconnect-SrmServer}
Script 11.2.0.... VMware.VimAutomation.Storage {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePo...
Script 1.3.0.0 VMware.VimAutomation.StorageUtility Update-VmfsDatastore
Script 11.2.0.... VMware.VimAutomation.Vds {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, E...
Script 11.2.0.... VMware.VimAutomation.Vmc {Connect-Vmc, Disconnect-Vmc, Get-VmcSddcNetworkService, G...
Script 10.0.0.... VMware.VimAutomation.vROps {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-O...
Script 6.5.1.7... VMware.VumAutomation {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Complia...
PS C:\Windows\system32>
didnt work till i imported the certs.
This is very strange.
The certificate warning should be given when you connect to the vCenter.
With the Ignore setting that warning will be suppressed.
You mention certs, plural, did you also import the certificates from the ESXi nodes?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I imported the Vcenter root certificate. we have multiple vcenters in different sites so i imported all of them. thats what i mean by Cert(s). If i understand how 6.5 works. the certificates on the esxi hosts are signed by a ca running on vcenter. that i believe is the cert i imported. we replaced the vcenter website certificate with a cert generated by Our CA.
Add this line anywhere before your Export-Vapp and it will fix it, just make sure you're cool with the security implications.
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Scope Session -Confirm:$false
I had the same issue, Export-Vapp broke after upgrading to the latest PowerCLI.
Unfortunately, the error that generates isn't helpful, at all, whatsoever.