Reply to Message

View discussion in a popup

Replying to:
PSScripter
Enthusiast
Enthusiast

Here is what I came up with, I have not used it yet..but I think it will work :slightly_smiling_face:

 

 

Connect-VIServer 'XXXXXXXXXXXXX'

$hosts = Get-Cluster "XXXXXXXXXX" | Get-VMHost
$cred = Get-Credential
$cmd = "mv /vmfs/volumes/INF03-PMAX-DS01/ucs-tool-esxi_1.2.1-1OEM.zip /tmp"
$cmd1 = "python /opt/ucs_tool_esxi/ucs_host_inventory.py"
    
foreach ($host in $hosts) {

    Get-VMHost $host | Get-VMHostService | Where-Object { $_.Key -eq "TSM-SSH" } | Start-VMHostService
    $session = New-SSHSession -ComputerName $host -Credential $cred -AcceptKey
    Invoke-SSHCommand -SSHSession $session -Command $cmd
    Get-esxcli software component apply -d /tmp/ucs-tool-esxi_1.2.1-1OEM.zip
    Invoke-SSHCommand -SSHSession $session -Command $cmd1 
    
    Remove-SSHSession -SSHSession $session | Out-Null 

}

 

 

Any thoughts on that piece of work lol?

Reply
0 Kudos