How to disable iLO Virtual NIC by Powershell script for a bunch of servers

Today I had to disable iLO Virtual NIC on many servers in my environment, therefore i did some search about it to do it via Powershell.

First you need to install iLO rest on a Windows machine, the latest version can be found here:

https://support.hpe.com/hpesc/public/swd/detail?swItemId=MTX_0ce8f37a6fec4558a471fb6c10

After you download and install the file please add the path “C:\Program Files\Hewlett Packard Enterprise\RESTful Interface Tool” into your Environment Variables

Now you can test the iLO rest tools by running Restfull Interface tools from your start menu:

Now the iLO rest is ready:

Open the power shell and use this script, but dont forget to provide all of your servers with , in the HPServers section and also provide the Credential inside the script


$HPServers = @("server1-ilo-ip","server2-ilo-ip","server3-ilo-ip")


foreach ($HPServer in $HPServers){
  Test-Connection $HPServer -Count 1 2>&1>$null | Out-Null
  $pingresult = echo $?

         if ($pingresult -eq $true ){
          ilorest login  $HPServer -u administrator -p <Change me with your Administrator Password>
           ilorest.exe get Oem/HPE/VirtualNICEnabled --selector=Manager.v1_5_1
             $status = ilorest.exe get Oem/HPE/VirtualNICEnabled --selector=Manager.v1_5_1
      
                        if ($status.split("=")[8] -eq "True"){
                          write-host "$HPServer"
                             ilorest set Oem/HPE/VirtualNICEnabled=false --selector=Manager.v1_5_1
                                #Start-Sleep -s 2
                                  ilorest commit
                                     #Start-Sleep -s 2
                                         ilorest iloreset }
                         else {
                         Write-Host "The Virtual Nic for $HPServer has been already Disabled"
                         #ilorest logout
                         }
        }

    else {
       Write-Host "Server $HPServer is not reachable"
       }

       
    
       }




If you just faced following error you dont have to pay attention to this, anyway the script will run

Chif driver not found, please check that the iLO channel interface driver (Chif) is installed.

Leave a Reply

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

+ 81 = 85