Forums

Servers

Servers
Information and ideas on Dell PowerEdge rack, tower and blade server solutions.

How to add OME Discovery Ranges remotely

This question is not answered

I don't ever want to have to launch a web browser to add a host into OME.  There are some powershell cmdlets to do this, but they require a snapin only present on the OME server.  Powershell Remoting can work around this.  Here is the code; just replace the variables up top.

# Set Variables
$IPAddress = "10.1.1.10"
$OMEServer = "ome-server.domain.local"
$GroupName = "YourGroupName"
$WSManPassword = "YourWSManPW"
 
# Establish Powershell Remoting
$DellOME = New-PSSession -ComputerName $OMEServer -Name OME
 
# Remote Scriptblock
Invoke-Command $DellOME -ScriptBlock {
       param([string]$IPAddress,[string]$GroupName,[string]$WSManPassword)
 
       # Create an XML file
       $TempFile = [IO.Path]::GetTempFileName()
       [System.XML.XMLDocument] $Global:XMLDocument = New-Object System.XML.XMLDocument
       $Declaration = $XMLDocument.CreateXmlDeclaration("1.0", "utf-8", $null)
       [System.XML.XMLElement] $XMLRoot = $XMLDocument.CreateElement("DiscoveryConfigurationRanges")
       $XMLDocument.InsertBefore($Declaration, $XMLDocument.DocumentElement)
       $XMLDocument.appendChild($XMLRoot)
       [System.XML.XMLElement] $XMLSystem = $XMLRoot.AppendChild($XMLDocument.CreateElement("Range"))
       $XMLSystem.SetAttribute("Name",$IPAddress)
       $XMLDocument.Save($TempFile)
      
       # Load the OME CLI Snapin
       Add-PSSnapin "Dell.OME.CLI"
      
       # Load the Range into the database and run a discovery and inventory
       Set-ModifyDiscoveryRangeGroup -GroupName $GroupName -AddRangeList $TempFile -WSManPassword $WSManPassword
       Set-RunDiscoveryInventory -Rangelist $TempFile
      
       # Remove the Temporary XML File
       Remove-Item $TempFile -Force
} -ArgumentList  $IPAddress,$GroupName,$WSManPassword
 

Some notes here:

  • There is no error correction.  You must have Powershell Remoting enabled on your OME server, and you must have admin rights to it.
  • You must already have a Discovery group created.
  • I'm only using SNMP and WSMan.  If you use any of the other protocols, you will have to add those passwords in param and -ArgumentList.
  • You have to use XML because Dell neglected to add a CSV option for Set-RunDiscoveryInventory.

Good luck!

All Replies
  • Agressiv,

    Great post, very helpful information. Thank you for sharing your solution with the community. 

    Chris Hawk

    Dell | Social Outreach Services - Enterprise
    Get Support on Twitter @DellCaresPro 
    Download the Dell Quick Resource Locator app today to access PowerEdge support content on your mobile device! (iOS, Android, Windows)