Hi All,
We are using vCenter & ESXi with 6.7 version.
PowerCLI Version:
----------------
VMware PowerCLI 6.5 Release 1 build 4624819
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component 6.5 build 4624453
VMware VimAutomation Core PowerCLI Component 6.5 build 4624450
VMWare ImageBuilder PowerCLI Component 6.5 build 4561891
VMWare AutoDeploy PowerCLI Component 6.5 build 4561891
VMware Vds PowerCLI Component 6.5 build 4624695
VMware Cloud PowerCLI Component 6.5 build 4624821
VMware HA PowerCLI Component 6.0 build 4525225
VMware HorizonView PowerCLI Component 7.0.2 build 4596620
VMware Licensing PowerCLI Component 6.5 build 4624822
VMware PCloud PowerCLI Component 6.5 build 4624825
VMware Storage PowerCLI Component 6.5 build 4624820
VMware vROps PowerCLI Component 6.5 build 4624824
VMware vSphere Update Manager PowerCLI 6.5 build 4540462
Data is incorporated in a CSV file.
While trying to change the portgroup for a VM. I am getting below error.
Even manually specifying the VM name & the port group also possess same error.
command executed:
Get-VM $c.name | Get-NetworkAdapter | ?{$_.Name -eq "Network adapter 1"} | Set-NetworkAdapter -NetworkName $c.portgroup -Connected:$true -Confirm:$false
Error:
Set-NetworkAdapter : 2/6/2019 9:28:42 AM Set-NetworkAdapter
Could not obtain
the result of task
'/VIServer=domain\adminaccount@vCenter:443/Task=Task-task-1457/'. Task
name is 'ReconfigVM_Task'. The following error occured: Exception has been
thrown by the target of an invocation.
At line:1 char:76
+ ... apter 1"} | Set-NetworkAdapter -NetworkName $c.portgroup -Connected: ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-NetworkAdapter], VimExcep
tion
+ FullyQualifiedErrorId : ViCore_TaskCoreService_ConvertTaskResult_Failed,
VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.SetNetworkAdapt
er
What is returned when you a Get-Task after this error message?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
No Error Message is displayed
It went to the next line for new command execution
And there is no output whatsoever from the Get-Task cmdlet?
Do you see the task in the Web Client under Tasks & Events?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I was having the same problem with the "Exception has been thrown by the target of an invocation" error for both the Set-NetworkAdapter and Start-VM commands today. The fix for me was to uninstall the Windows Installer package for PowerCLI (Add/Remove Programs) and install directly via PowerShell (see https://www.vladan.fr/how-to-install-vmware-powercli-via-powershell/ ). After I installed and rebooted the problem went away. It looks like I was running PowerCLI 6.5 (VMware-PowerCLI-6.5.0-4624819.exe) instead of the PowerCLI 6.7, which is installed via the following command:
Install-Module -Name VMware.PowerCLI
Let me know if that works for you.
Tim