Restart iBMC (Huawei): Unterschied zwischen den Versionen
Aus Wiki-WebPerfect
Admin (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „<source lang="PowerShell"> $Node = "<iBMC IP>" $Headers = @{Authorization = "Basic <TOKEN>"} #region HTTP Basic Auth #region SSL - Because of the unsigned ce…“) |
Admin (Diskussion | Beiträge) |
||
Zeile 1: | Zeile 1: | ||
+ | ''With the following PowerShell-Script you can restart the iBMC. That OS on the hardware does not affect, only iBMC restarts.'' | ||
+ | |||
+ | |||
<source lang="PowerShell"> | <source lang="PowerShell"> | ||
− | $Node = "<iBMC IP>" | + | $Node = "<iBMC IP>" #IP or Hostname of the iBMC instance -> Please change |
− | $Headers = @{Authorization = "Basic <TOKEN>"} # | + | $Headers = @{Authorization = "Basic <TOKEN>"} #HTTP Basic Authentication -> Please change |
Aktuelle Version vom 21. September 2020, 12:47 Uhr
With the following PowerShell-Script you can restart the iBMC. That OS on the hardware does not affect, only iBMC restarts.
$Node = "<iBMC IP>" #IP or Hostname of the iBMC instance -> Please change $Headers = @{Authorization = "Basic <TOKEN>"} #HTTP Basic Authentication -> Please change #region SSL - Because of the unsigned certs in iBMC we have to trust all certs add-type @" using System.Net; using System.Security.Cryptography.X509Certificates; public class TrustAllCertsPolicy : ICertificatePolicy { public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { return true; } } "@ [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3, [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12 #REST Call to find the Blade-Number $Blade = ((Invoke-RestMethod -Uri "https://$Node/redfish/v1/Systems" -Method Get -Headers $headers -ErrorAction Continue).Members)."@odata.id" -split "/" | Select-Object -Last 1 #REST call to restart iBMC $Body = @{ResetType = "ForceRestart"} | ConvertTo-Json Invoke-WebRequest -Uri "https://$Node/redfish/v1/Managers/$Blade/Actions/Manager.Reset" -Method POST -Body $Body -Headers $Headers -ContentType "application/json" -UseBasicParsing