I'm still trying to get this working correctly. Here is my latest, and the error I am getting:
Connect-VIServer 'XXXXXXXXXXXXX'
$hosts = Get-Cluster -name "XXXXXXXXXXX" | Get-VMHost
$cred = Get-Credential
$cmd = "mv /vmfs/volumes/INF03-PMAX-NonProd-DS01/ucs-tool-esxi_1.2.1-1OEM.zip /tmp"
$cmd1 = "python /opt/ucs_tool_esxi/ucs_host_inventory.py"
$arguments = @{
'VIBURL' = '/tmp/ucs-tool-esxi_1.2.1-1OEM.zip'
}
foreach ($esx in $hosts) {
# Get-VMHost $esx | Get-VMHostService | Where-Object { $_.Key -eq "TSM-SSH" } | Start-VMHostService
$session = New-SSHSession -ComputerName $esx -Credential $cred -AcceptKey
Invoke-SSHCommand -SSHSession $session -Command $cmd
$esxcli = Get-EsxCli -VMHost $esx
$esxcli.software.component.apply.Invoke($arguments)
Invoke-SSHCommand -SSHSession $session -Command $cmd1
Remove-SSHSession -SSHSession $session | Out-Null
}The copy seems to work, but the esxcli command is failing with this:
MethodInvocationException: C:\Temp\vSphere\Install-UCSTools.ps1:19
Line |
19 | $esxcli.software.component.apply.Invoke($arguments)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Exception calling "Invoke" with "1" argument(s): "A specified parameter was not correct: argument[1]"
Any thoughts on how I can get this working?
Thank You.