Hi,
I'm looking for a method to automate the specific setting for HPE iSUT (Integrated ) described here https://support.hpe.com/resource3/docDisplay/pdfjs/web/viewer.html?file=%2Fhpesc%2Fpublic%2Fapi%2Fdo...
Basically it is inside a SSH or Console shell:
sut -set mode=AutoDeployReboot
As I'm upgrading our ESXi's via a PowerShell script, it would be highly beneficially to issue the above command inside the PowerCLI session, instead accessing the host manually.
Key question: Is there any way inside PowerCLI to execute a custom command on the host side?
Thanks and regards,
Nico
While looking on the HP forum, it seems that this a 2-step process.
I consulted https://community.hpe.com/t5/ProLiant-Servers-ML-DL-SL/Updating-Gen10-running-ESXi-struggling-with-i...
Step 1: install the VIB
There you can use the Get-EsxCli cmdlet to do that, no need for an SSH session to run the esxcli command
Make sure to use the V2 switch, see PowerCLI 6.3 R1: Get-ESXCLI Why the V2? for details
Step 2: Run the sut commands
This requires an SSH session as far as I can tell.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
By chance, I found my old post here, and I wondered if the suggestions made by @vmwaresbrf and @Casper42 are really working...
So, it is confirmed, I updated my PowerCLI to the latest (13.1.0) version and checked the host directory
[root@xxxvrthst01:~] ls /opt/sut/bin/
gatherlogs.sh sut sutd.sh sutesxcli.sh
There is indeed a wrapper, called "sutesxcli.sh" which is translating parameters in calls to the "sut" program.
Finally, utilizing the V2 of ESXCLI, you can change the SUT mode via PowerCLI / ESXCLI like following
# Create an ESXCLI object
$esxcli = Get-VMhost "xxxvrthst01*" | Get-ESXcli -V2
# Change the mode to 'AutoDeployReboot'
$esxcli.sut.mode.set.Invoke(@{mode = 'AutoDeployReboot'})
Looking further, there are interesting Elements and Methods for other management use cases, but this would be offtopic
$esxcli.sut
==================
EsxCliElement: sut
Elements:
---------
ilocreds
iloqueuedupdates
mode
pollingintervalinminutes
stagingdirectory
Method Elements:
---------
clearilocreds
deregister
export
import
start
stop
Methods:
--------
string Help()
If the command can be given over SSH you could look at the Posh-SSH module.
It allows to set up SSH sessions and send commands.
See my Use Posh-SSH instead of PuTTY dive.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD
Thanks for your fast response. Yes, indeed, the SSH scripted way might be the workaround, but instead of dealing with another set of authentication, service management (ssh), execution of the command only for running a command inside the host, I was really expecting there is something useful inside PowerCLI. If not, sadly, but then your proposal seems to be only chance for automation.
If the target OS was running VMware Tools you could use Invoke-VMScript.
But since your target is an ESXi node, that option is not available I'm afraid.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
LucD
Yep, that is the case here. Therefore I still hope there are other options, otherwise you will get my "Correct Answer"
While looking on the HP forum, it seems that this a 2-step process.
I consulted https://community.hpe.com/t5/ProLiant-Servers-ML-DL-SL/Updating-Gen10-running-ESXi-struggling-with-i...
Step 1: install the VIB
There you can use the Get-EsxCli cmdlet to do that, no need for an SSH session to run the esxcli command
Make sure to use the V2 switch, see PowerCLI 6.3 R1: Get-ESXCLI Why the V2? for details
Step 2: Run the sut commands
This requires an SSH session as far as I can tell.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
FYI, Newer Versions of SUT are now ESXCLI Enabled.
I haven't gone looking for docs, but if you check /opt/sut/bin on one of your hosts, look for 2 files that mention ESXCLI.
One is just something like SUTESXCLI and the other is same but .SH
If you see those, you can invoke SUT via ESXCLI.
However, I just tried to use the Get-EsxCli method in PowerCLI and it seems to error out when trying to define $arguments against SUT.
I've posted the question inside HPE and will try to poke the iLO Devs who work on SUT with a sharp stick to get them to add proper support for this method.
Would be wonderful if you could simply loop through all the members of a cluster via PowerCLI and then use Get-EsxCli to set the SUT options you want.
Hello, you can use .ps1 script like this:
##############################
$VC = "your vcenter name"
$cluster = "your cluster name"
$mode = "ondemand"
#$mode = "autodeploy"
#$mode = "autostage"
#$mode = "autodeployreboot"
Connect-viserver -Server $VC
$hosts = Get-Cluster $cluster |Get-VMHost
foreach($vihost in $hosts){
Write-Host "ESX: $vihost" -ForegroundColor Green
$esxcli = get-vmhost $vihost | Get-EsxCli
$esxcli.sut.mode.set($mode)
}
##############################
1. Don`t forget uncomment needed mode!
2. You may need to add Username and Password to Connect-viserver command.
3. Another options for sutesxcli you can find by executing from ssh on esxi with one of latest isut version installed this command: "esxcli sut", then hit enter
By chance, I found my old post here, and I wondered if the suggestions made by @vmwaresbrf and @Casper42 are really working...
So, it is confirmed, I updated my PowerCLI to the latest (13.1.0) version and checked the host directory
[root@xxxvrthst01:~] ls /opt/sut/bin/
gatherlogs.sh sut sutd.sh sutesxcli.sh
There is indeed a wrapper, called "sutesxcli.sh" which is translating parameters in calls to the "sut" program.
Finally, utilizing the V2 of ESXCLI, you can change the SUT mode via PowerCLI / ESXCLI like following
# Create an ESXCLI object
$esxcli = Get-VMhost "xxxvrthst01*" | Get-ESXcli -V2
# Change the mode to 'AutoDeployReboot'
$esxcli.sut.mode.set.Invoke(@{mode = 'AutoDeployReboot'})
Looking further, there are interesting Elements and Methods for other management use cases, but this would be offtopic
$esxcli.sut
==================
EsxCliElement: sut
Elements:
---------
ilocreds
iloqueuedupdates
mode
pollingintervalinminutes
stagingdirectory
Method Elements:
---------
clearilocreds
deregister
export
import
start
stop
Methods:
--------
string Help()