Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

From Manual to Automated - Managing Dell iDRAC Power via Redfish API and PowerShell

Managing server power states manually is time-consuming, especially in large-scale environments or remote setups. For IT administrators overseeing Dell PowerEdge servers, automation is key to efficiency. Enter iDRAC (Integrated Dell Remote Access Controller) and the Redfish API—a modern RESTful standard for systems management.

In this guide, you’ll learn how to automate server power management tasks using PowerShell and iDRAC’s Redfish API. Whether you’re rebooting a frozen server, checking power states, or scripting bulk operations, this tutorial will equip you with actionable code and best practices.

What You’ll Need

  1. A Dell PowerEdge Server with iDRAC.

  2. Network Access to the iDRAC interface (IP address/credentials).

  3. PowerShell 5.1 + (Windows/Linux/macOS).

  4. Basic familiarity with REST APIs and PowerShell scripting.

Step 1: Enable Redfish API on iDRAC

  1. Log into the iDRAC web interface (https://<iDRAC_IP>).

  2. Navigate to iDRAC SettingsNetwork Protocols.

  3. Enable Redfish API and note the port (default: 443).

  4. Ensure your iDRAC user account has Administrator privileges

Step 2: PowerShell Script to Check Server Power State

Below is a script to retrieve the current power state of your Dell server:

# Configure iDRAC Credentials
$iDRAC9 = "192.168.1.100"  # Replace with your iDRAC IP
$userName = "root"
$password = "YourSecurePassword"  # Avoid hardcoding in production!
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential ($userName, $securePassword)

# Redfish API Endpoints
$chassisAPIUrl = "https://$iDRAC9/redfish/v1/Chassis/System.Embedded.1"
$headers = @{ Accept = "application/json" }

# Retrieve Power State
try {
    $response = Invoke-RestMethod -Uri $chassisAPIUrl -Method Get -Credential $credentials -Headers $headers -SkipCertificateCheck
    Write-Host "Server Power State: $($response.PowerState)" -ForegroundColor Cyan
} catch {
    Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red
}

Download this script here or it is also available on GitHub.com.

Automating server power management with PowerShell and iDRAC9’s Redfish API simplifies operations, reduces human error, and unlocks scalability. By leveraging the script examples above, you can extend this foundation to automate firmware updates, hardware monitoring, and more.

Useful Articles
Powershell GUI System Hardware Information
Executing PowerShell script from PHP HTML web server
Send system disk space utilization HTML report Email using PowerShell
Send Email using PowerShell with .net object System.Net.Mail.MailMessage
PowerShell XML OperationStopped: No coercion operator is defined between types 'System.Object&' and 'System.Object'
Powershell Create new file if not exist, if exist Rename file
PowerShell Create XML document with XmlWriter .net object
PowerShell save export data to XML file
Bulk change multiple file names with OneLiner PowerShell command
Resolved PowerShell Visual studio code stuck with 'Starting up PowerShell' in status bar
Building basic simple Web Server using PowerShell

Go Back

Comment

Blog Search

Page Views

12783665

Follow me on Blogarama