Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

iLO or DRAC

Posted on 2008-06-23
12
Medium Priority
?
4,706 Views
Last Modified: 2013-05-02
Does anyone know how I can remotely use a batch/vb/powershell script to turn on a bunch of servers using the HP iLO and also the Dell DRAC??  
0
Comment
Question by:loftyworm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
  • +1
12 Comments
 
LVL 48

Expert Comment

by:Jay_Jay70
ID: 21851520
they are web based applications that you need to log on to - i cant imagine there is any way to do this via wmi or anything like that
0
 
LVL 18

Expert Comment

by:BSonPosh
ID: 21851754
You can.. and I have a powershell script that does just that (at least HP.)

You can use the HP CLI or send the Magic Packet.

whats your preference... the magic packet should work for both.
0
 
LVL 11

Author Comment

by:loftyworm
ID: 21851814
Both please, as this is a learning experience, I will have to see which one works best in our environment.  I am pretty sure Dell has a similar command line thing, do you know that one?

btw, magic packet is a new term for me, what is that?
0
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
LVL 48

Expert Comment

by:Jay_Jay70
ID: 21851820
thats unreal, i am very keen to see that script
0
 
LVL 18

Expert Comment

by:BSonPosh
ID: 21851856
I will post it a few... spending time with the wife atm :)

Magic Packet
http://en.wikipedia.org/wiki/Wake-on-LAN
0
 
LVL 18

Accepted Solution

by:
BSonPosh earned 2000 total points
ID: 21851971
Here is the Magic packet script. I will have to wait till tomorrow to get the CLI stuff.

It requires the MAC address but that should easy to get.
########################################################################################
param ($macString = $(throw 'mac address is required'),
       [switch]$verbose)
if($verbose){$verbosePreference = "continue"}
if($macString -notmatch ":")
{
    Write-Verbose "Converting $macstring to Mac Address"
    $macaddy = import-csv $table | ?{$_.Name -match $macString} | %{$_.Mac}
    Write-Verbose "Converted to $macaddy"
}
else
{
    $macaddy = $macString
}
 
$mac = $macaddy.split(':') | %{ [byte]('0x' + $_) }
 
if ($mac.Length -ne 6)
{
    throw 'mac address must be 6 hex numbers separated by :'
}
Write-Verbose "Creating UDP Packet"
$UDPclient = new-Object System.Net.Sockets.UdpClient
$UDPclient.Connect(([System.Net.IPAddress]::Broadcast),4000)
$packet = [byte[]](,0xFF * 6)
$packet += $mac * 16
Write-Verbose ([bitconverter]::tostring($packet))
[void] $UDPclient.Send($packet, $packet.Length)
Write-Verbose "Wake-On-Lan magic packet of length $($packet.Length) sent to $macString"
########################################################################################

Open in new window

0
 
LVL 18

Expert Comment

by:BSonPosh
ID: 21856091
Here is my Invoke-iLOCommand.ps1 file. It requires CMDLets from nsoftware. If you dont want to use those you can use plink.exe

nSoftware
http://www.nsoftware.com/powershell/

Plink.exe
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Basically this will send any command you want to the iLO.
In your case
Invoke-iLOCommand.ps1 -cmd "Power On" -server x
# requires snapin Netcmdlets
# Invoke-iLOCommand
Param($cmd = $(throw '$CMD is Required'),
      $list,
      $server,
      $creds = $(Get-Credential),
      $filter = ".*"
      )
	function Ping-Server {
		Param([string]$srv)
		$pingresult = Get-WmiObject win32_pingstatus -f "address='$srv'"
		if($pingresult.statuscode -eq 0) {$true} else {$false}
	}
Write-Host
 
if(!$list -and !$Server){Write-Host "You must Provide a List of Servers or a Server" -fore Yellow}
 
if($list)
{
    if(Test-Path $list)
    {
        foreach($server in (get-Content $list))
        {
            if(Ping-Server $Server)
            {
                Write-Host " + Invoking Command:[$cmd] on Server:[$Server]" -Fore Green
                $result = Invoke-SSH -command $cmd -Server $server -Credential $creds -force 
                $result = $result | Foreach-Object{$_.Text.Split("`n")} | Where-Object{$_ -match $filter}
                $result
            }
            else
            {
                Write-Host "Ping of Server [$Server] Failed" -fore Red
            }
            Write-Host
        }
    }
    else
    {
        Write-Host "Invalid List File [$list]"  -fore Red
    }
}
 
if($server)
{
    if(Ping-Server $Server)
    {
        $result = Invoke-SSH -command $cmd -Server $server -Credential $creds -force 
        $result = $result | Foreach-Object{$_.Text.Split("`n")} | Where-Object{$_ -match $filter}
        $result
    }
    else
    {
        Write-Host "Ping of Server [$Server] Failed"  -fore Red
    }
}
Write-Host

Open in new window

0
 
LVL 11

Author Comment

by:loftyworm
ID: 21857288
Thank you :)  I will read into this toady.  Does anyone have any additions for the Dell DRAC?
0
 
LVL 48

Expert Comment

by:Jay_Jay70
ID: 21861672
that is freakin unreal - especially as i am about to buy a 16 blade enclosure running ILO cards - you have my thanks big time :) very cool
0
 
LVL 18

Expert Comment

by:BSonPosh
ID: 21861827
Your welcome. :)
0
 
LVL 11

Author Closing Comment

by:loftyworm
ID: 31470006
Only half of my question, but a great answer all the same, ty :)
0
 

Expert Comment

by:Charlesll4
ID: 39133925
How can the above Powershell script be used with Plink.exe?
0

Featured Post

AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question