How to connect to HPE Cmdlets using PowerShell and a script to change iLO Alert mail

Problem:

How do I connect to HPE Cmdlets using PowerShell and a script to change iLO Alert mail?

Solution:

Run the top commands first to connect install the cmdlets:

Install-Module -Name HPEiLOCmdlets -RequiredVersion 3.2.0.0

Install-Module -Name HPEiLOCmdlets

Install-PackageProvider -Name NuGet -Force

Install-Module -Name PowerShellGet -Force


$InputFile = "C:\Temp\HPEServers.csv"
$MyHPEFile = Import-CSV $InputFile
$credential = Get-Credential
$emailServer = "emailserver.com"
$AlertMailEmail = alert@mail.com
$smtpuser = "user"
$smtppass = "pass"
foreach ($HPServer in $MyHPEFile) {
    $Server = $HPServer.ServersiLO
    $connection = Connect-HPEiLO -Credential $credential -DisableCertificateAuthentication -IP $Server
    $domain = Get-HPEiLOServerInfo -Connection $connection | select -ExpandProperty Servername
    $newdomain = $domain -replace ".domain.com" -replace "
    $domainfull = $newdomain + "@domain.com
    Set-HPEiLOAlertMailSetting -Connection $connection -AlertMailEmail $AlertMailEmail -AlertMailEnabled Yes -AlertMailSenderDomain "$domainfull" -AlertMailSMTPServer $emailServer -AlertMailSMTPPort 587 -AlertMailSMTPAuthEnabled Yes -AlertMailSMTPAuthUser $smtpuser -AlertMailSMTPAuthPw $smtppass -AlertMailSMTPSecureEnabled Yes -Force
} 

Leave a Reply

Your email address will not be published. Required fields are marked *