cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
126
Views
0
Helpful
2
Replies

How to reboot a server managed by Intersight with powershell?

arnold-romeijn
Level 1
Level 1

We made a script to deploy new ESXi servers. (in powershell)
It creates a  profile from a template and connects a server to it.
Then we set the correct files to make it http boot and install ESXi.
But I cannot find the command to reboot the server to start the installation process.

"Set-IntersightComputeServerSetting -AdminPowerState Reboot " looked promising but that does not reboot the server but reboots the managament controller.

Anybody have any ideas.

 

 

1 Accepted Solution

Accepted Solutions

Mark Morsing
Level 1
Level 1

Hello @arnold-romeijn 

I just played around with the commands and it's correct that "-AdminPowerState Reboot" only reboots the controller.
But depending on how rough you want to be. HardReset and PowerCycle reboots the server.

I did the following.

#Collects the server profile
$ServerProfile = Get-IntersightServerProfile -Name "PROFILENAME"

#Collects Computeblade associated with the server profile
$ComputeBlade = Get-IntersightComputeBlade -Moid $ServerProfile.AssignedServer.ActualInstance.Moid
#Gets the specific servers settings
$ComputeServerSettings = Get-IntersightComputeServerSetting -Name $ComputeBlade.Name

$ComputeServerSettings | Set-IntersightComputeServerSetting -AdminPowerState PowerCycle

This also works
$ComputeServerSettings | Set-IntersightComputeServerSetting -AdminPowerState Hardreset


I get a barcalona error when i run the command, but it actually reboots the server

View solution in original post

2 Replies 2

Mark Morsing
Level 1
Level 1

Hello @arnold-romeijn 

I just played around with the commands and it's correct that "-AdminPowerState Reboot" only reboots the controller.
But depending on how rough you want to be. HardReset and PowerCycle reboots the server.

I did the following.

#Collects the server profile
$ServerProfile = Get-IntersightServerProfile -Name "PROFILENAME"

#Collects Computeblade associated with the server profile
$ComputeBlade = Get-IntersightComputeBlade -Moid $ServerProfile.AssignedServer.ActualInstance.Moid
#Gets the specific servers settings
$ComputeServerSettings = Get-IntersightComputeServerSetting -Name $ComputeBlade.Name

$ComputeServerSettings | Set-IntersightComputeServerSetting -AdminPowerState PowerCycle

This also works
$ComputeServerSettings | Set-IntersightComputeServerSetting -AdminPowerState Hardreset


I get a barcalona error when i run the command, but it actually reboots the server

arnold-romeijn
Level 1
Level 1

Thank you Mark, that works!
Now i found (well, somebody send me the link )it in the API docs where the options are explained:
Cisco Intersight API Docs

  • AdminPowerState:

    string

     

    User configured power state of the server.
    * `Policy` - Power state is set to the default value in the policy.
    * `PowerOn` - Power state of the server is set to On.
    * `PowerOff` - Power state is the server set to Off.
    * `PowerCycle` - Power state the server is reset.
    * `HardReset` - Power state the server is hard reset.
    * `Shutdown` - Operating system on the server is shut down.
    * `Reboot` - Power state of IMC is rebooted.

     

     

 

Review Cisco Networking for a $25 gift card