VMware Cloud Community
Sobhim
Contributor
Contributor

Import-vapp error

Hi Guys, 

I am really struggling recently with my VM Creation script which was working before, Import-VApp always throwing errors and I tried several online solutions with no hope; Would you please look and advise if possible

>> This is the code that throws the error:
$VMTemplate = Import-VApp -Source LocalD:\EC_W2K16_X64_ST_V01.1.ovf -Name ("EC_W2K16_X64_ST_V01.1"+(date)) -VMHost $VMESXi -Force | Set-VM -ToTemplate -Confirm:$false -Verbose

>> This is the error on powershell:
Import-VApp : 1/5/2021 1:49:04 PM Import-VApp An error occurred while sending the request.
At D:\EC_TOOLKIT\VMCreation\VMCreation.ps1:262 char:18
+ ... MTemplate = Import-VApp -Source LocalD:\EC_W2K16_X64_ST_V01.1.ovf -Na ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-VApp], ViError
+ FullyQualifiedErrorId : Client20_NfcLease_RunNfcTask_Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.ImportVA
pp

>> This is the error on vCenter tasks:
"The task was canceled by a user"

0 Kudos
9 Replies
Sobhim
Contributor
Contributor

can someone assist here. 

0 Kudos
scott28tt
VMware Employee
VMware Employee

@Sobhim 

Moderator: Please note that VMTN contributors are usually doing so voluntarily in their own time.

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
0 Kudos
LucD
Leadership
Leadership

Can you have a look in the vpxd log on the VCSA?
That might contain more information on what is happening.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Sobhim
Contributor
Contributor

Hi @scott28tt .. It may be just I used to see replies and interactions a bit faster here however I submitted the question during the Christmas time which all shall be away or off .. thanks any way 

0 Kudos
LucD
Leadership
Leadership

Coming back to your anxiety to get a response, I tend to NOT prioritise users who don't give feedback on their previous threads.
So yes, you were not on my "reply now" list I'm afraid.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Sobhim
Contributor
Contributor

Hi Guys, 

I am sure that my words wasn't understood the way I wanted and I am sure I didn't want the picture to be that uncomfortable with you. 

I admire you guys @LucD & @scott28tt; really like your work and how you put your deep knowledge and experience into helping and assisting us during your very tight time and as @scott28tt highlighted, it is voluntarily so I really appreciate this and respect the way you priorities how you reply; totally respected. By the way the previous threads helped me to solve my previous shared matters; Thanks a lot and sorry for not being polite to give a feedback.

For my subject question I searched how to get the vpxd file and I am attaching it. 

I went through it and I guess this is the issue "2021-01-13T15:10:43.846Z warning vpxd[44846] [Originator@6876 sub=VmProv opID=707f0955] Unable to lookup ds for disk" 
the script can't access the DS provider. Am I correct. 

0 Kudos
LucD
Leadership
Leadership

Yes, it looks indeed as if the import doesn't find a datastore for a specific disk in the OVA/OVF.

Did you check if there is a property with the OVA/OVF that needs to be set?
You can do that with Get-OvfConfiguration.

You can also try adding the Datastore parameter on the Import-Vapp cmdlet.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Sobhim
Contributor
Contributor

I was trying in the meantime to play with import-vapp with respect to datastore and optional parameters and even ran it with only esxi and datastore but still the same beautiful error - running the same cmdlt with verbose didn't throught any thing usefull  

Import-VApp : 1/5/2021 1:49:04 PM Import-VApp An error occurred while sending the request.
At D:\EC_TOOLKIT\VMCreation\VMCreation.ps1:262 char:18
+ ... MTemplate = Import-VApp -Source LocalD:\EC_W2K16_X64_ST_V01.1.ovf -Na ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-VApp], ViError
+ FullyQualifiedErrorId : Client20_NfcLease_RunNfcTask_Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.ImportVA

Also Get-OvfConfiguration returning one property (networkmapping) which I suspect a bit to be the source of the failure as the same OVF used to work previously and also the script as well so I am suspecting TLS version on esxi's mentioned here (https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Unable-to-Export-vm-on-newest-version-...

Will look further and share here

0 Kudos
wesley_yalipu
Enthusiast
Enthusiast

Just to clear things out, this cmdlet cannot work with this syntax.

$VMTemplate = Import-VApp -Source LocalD:\EC_W2K16_X64_ST_V01.1.ovf -Name ("EC_W2K16_X64_ST_V01.1"+(date)) -VMHost $VMESXi -Force | Set-VM -ToTemplate -Confirm:$false -Verbose

Your source location has an unexpected "Local" hanging out there.

$vApp_Source = Get-ChildItem -Path 'd:\' -Filter "*W2K16*.ovf"
$VMTemplate = Import-VApp -Source $vApp_Source.Fullname -Name ($vApp_Source.Basename + (Get-date -Format d)) -VMHost $VMESXi -Force | Set-VM -ToTemplate -Confirm:$false -Verbose

Would make sure there isn't any issues with the path for example. 

0 Kudos