This blog is originally written by Teixeira Fabiano

Greetings,

The DellEMC iDRAC (Integrated Dell Remote Access Controller) is a great feature available for a long time on the DellEMC; the 9th generation was just delivered on our new 14G. How great it is to power off/on a server remotely without having to go to your datacenter? It can save you headaches as well as time and money when issues arise. The example above is just one of the features that iDRAC offers (For more information on iDRAC, click here).

Let’s talk about real life here. You just got a new job as a server administrator, however you don’t know how the environment is configured yet. What should I do? Well, you can always start by looking at the iDRAC information. It can provide hardware logs, you can access the server console and much more. But how do you connect to the iDRAC? You don’t know the IP addresses yet, so how can you discover them?

You can use a simple PowerShell script, if you can connect to the Windows Server OS. The script pulls the iDRAC IP information from Windows 2016 servers that are connected to a MS Active Directory domain. The script is very helpful since you don’t need to install any agent in the servers.

---------------------
Script Output
---------------------
.\Get-iDracInfo.ps1

But if the iDRAC does not have an IP address assigned? You can still do it via PowerShell. It’s super simple. Here is an example:

---------------------
Changing iDRAC IP Address to Static from DHCP
---------------------
Set-PcsvDeviceNetworkConfiguration -CimSession HV02 -IPv4AddressOrigin Static -IPv4Address 192.168.2.152 -IPv4SubnetMask 255.255.255.0 -IPv4DefaultGateway 192.168.2.254 -Verbose

---------------------
Changing iDRAC IP Address to DHCP from Static
---------------------
Set-PcsvDeviceNetworkConfiguration -CimSession HV02 -IPv4AddressOrigin DHCP -Verbose

--------------------
Get-iDracInfo.ps1
---------------------

<#
.Synopsis
   Display iDRAC information.

.DESCRIPTION
   This script is designed to provide iDRAC (Integrated DellEMC Remote Access Controller
   information on DellEMC Servers running Windows Server 2016.

.REQUIREMENTS
   Remote Server Administrator Tools (RSAT) for Windows 10 or
   Active Directory module for Windows PowerShell (RSAT-AD-PowerShell), if you
   are running the script from a server. Also, ICMP must be allowed in order to test if server is up-and-running.

.NOTES
   Created by: Fabiano Teixeira
   Modified: 8/31/2017
 
#>

#Creating new Directory and Temp Files, ignoring error if directory/file already exist
New-Item -Type Directory -Path C:\Dell\Script\iDracInfo -ErrorAction SilentlyContinue
New-Item -ItemType File -Path C:\Dell\Script\iDracInfo\DellEMCServerList.csv -ErrorAction SilentlyContinue
New-Item -ItemType File -Path C:\Dell\Script\iDracInfo\ServerList.csv -ErrorAction SilentlyContinue

#Get server information from Active Directory - Computer object must be enabled in AD and OS must be WS2016, then export information to a CSV - Excluding Cluster CNO
Get-ADComputer -Filter {(OperatingSystem -like "*Server 2016*") -and (Enabled -eq "True") -and (Description -notlike "*" -or (Description -notlike "*Cluster virtual network*"))} | Select-Object Name | Export-Csv -Path "C:\Dell\Script\iDracInfo\ServerList.csv" -NoTypeInformation

#Import CSV to variable
$ServerList = Import-Csv -Path C:\Dell\Script\iDracInfo\ServerList.csv


#Test Server connectivity, determine if server is a VM or Physical and determine if server is a DellEMC Server, export DellEMC server list to a CSV
ForEach ($Server in $ServerList)
{
    $Ping = Test-Connection -ComputerName $Server.name -Count 2 -Quiet
    If ($Ping -eq $True)
    {
        $ServerInfo = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $Server.name -ErrorAction SilentlyContinue

        If ($ServerInfo.model -match "Virtual" -or $ServerInfo.model -match "VM" -and $ServerInfo.manufacturer -ne "Dell Inc.")
        {
            Write-Host "Server "$Server.name" is a VM or a Non-DellEMC Server." -ForegroundColor Yellow
        }
        Else
        {
            $ServerInfo | Select-Object Name,Manufacturer,Model | Export-Csv -Path "C:\Dell\Script\iDracInfo\DellEMCServerList.csv" -Append -NoTypeInformation
        }
    }
}

#Import CSV
$iDracList = Import-Csv -Path C:\Dell\Script\iDracInfo\DellEMCServerList.csv -ErrorAction SilentlyContinue

#Display iDRAC Information
If ($iDracList.Name -eq $null)
{
    Write-Host "No DellEMC servers running Windows 2016 were found!"  -ForegroundColor Red
}
Else
{
   
    #Export Info to a CSV file
    Get-PcsvDevice -CimSession $iDracList.Name | Select-Object PSComputerName,Model,CurrentBIOSVersionString,IPv4Address,IPv4SubnetMask,IPv4DefaultGateway | Export-Csv "C:\Dell\Script\iDracInfo\MyDellEMCServerList.csv" -Append -NoTypeInformation
   
    #Display Info on screen
    Get-PcsvDevice -CimSession $iDracList.Name | Sort-Object -Property PSComputerName | ft PSComputerName,Model,CurrentBIOSVersionString,IPv4Address,IPv4SubnetMask,IPv4DefaultGateway -ErrorAction SilentlyContinue
}

#Cleanup - Removing Temp Files
Remove-Item -Path C:\Dell\Script\iDracInfo\ServerList.csv
Remove-Item -Path C:\Dell\Script\iDracInfo\DellEMCServerList.csv

---------------------
Conclusion

---------------------

Understanding how the environment is configured is crucial for administrators so they can fully manage their systems. PowerShell/iDRAC are extremely important tools that can help you with this task, don’t forget about that. Hope you have enjoyed this blog. Please feel free to provide any comments, suggestions.

 

Cheers!

Fabiano Teixeira