Restart iBMC (Huawei): Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
(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…“)
(kein Unterschied)

Version vom 21. September 2020, 12:44 Uhr

$Node = "<iBMC IP>"
$Headers = @{Authorization = "Basic <TOKEN>"} #region HTTP Basic Auth
 
 
#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