Sample PowerShell Scripts with OMSA

(http://en.community.dell.com/techcenter/systems-management/w/wiki/sample-powershell-scripts-with-omsa.aspx)

sample Function to launch DRAC, based on computer name

Below are sample PowerShell scripts for querying data from OMSA – download the attached .txt file for all the examples.

get-wmiobject -namespace root\cimv2\dell -computer Server1 -list | sort-object name Displays all classes int he root\cimv2\dell namespace on Server1
$a = get-wmiobject dell_chassis -namespace root\cimv2\dell -computer Server1
$a | select-object AmpStatus, EsmLogStatus, FanRedStatus, FanStatus, MemStatus, Model, ProcStatus, PsRedStatus, PsStatus, SecurityBreach, SerialNumber, Status, SystemClass, TempStatus, VoltStatus, VrmStatus
Displayoverall hardware status based on info from Dell_Chassis
$a = get-wmiobject Dell_baseboard -namespace root\cimv2\dell -computer Server1
$a.PartNumber, $a.BaseBoardTypeDescString
Display the part number of the motherboard
$a = get-wmiobject cim_PhysicalMemory -namespace root\cimv2\dell -computer Server1
$a | select-object capacity, datawidth, formfactor, memorytype, name, speedasstring, status, tag, totalwidth | format-table
Displays Physical Memory information (speed, type, etc)
$a = get-wmiobject cim_temperaturesensor -namespace root\cimv2\dell -computer Server1
$a | select-object baseunits, CurrentReading, LowerThresholdCritical, LowerThresholdNonCritical, name, status, unitmodifier, upperthresholdcritical,upperthresholdnoncritical
Show Current Temperature sensor information (CurrentReading in Celsius)
get-wmiobject cim_tachometer -namespace root\cimv2\dell -computer Server1 | select-object Name, CurrentReading Displays Current Fan Speed
get-wmiobject cim_fru -namespace root\cimv2\dell -computer Server1 | select-object DeviceID, FRUManufacturerName, FRUPartNumberName, FRUSerialNumberName Displays “Field Replaceable Units” (FRU) information for specific components
get-wmiobject cim_powersupply -namespace root\cimv2\dell -computer Server1 | select-object name, DeviceID, Status, TotalOutputPower Displays the total output power of the supply – in milliwatts
get-wmiobject cim_processor -namespace root\cimv2\dell -computer Server1 | select-object CoreCount, CoreEnabledCount, CPUStatus, CurrentClockSpeed, DeviceID, MaxClockSpeed, Name | ft -autosize Displays processor information
get-wmiobject dell_networkport -namespace root\cimv2\dell -computer Server1 | select-object OSAdapterDescription, IsTOEEnable Displays if TCP Offload Engine (TOE) is enabled
$a = get-wmiobject DELL_PowerConsumptionData -namespace root\cimv2\dell -computer Server1
$a | select-object Name, CumulativePowerReading, maxPowerConsumption, minPowerConsumption, parStartTime, parTime, peakAmpReading, peakHeadRoom, peakWattReading, powerCap, powerCapCapabilities, pwrStartTime, pwrTime, Status
Displays valuable power consumption information – shows “CumulativePowerReading based from pwrStartTime, as well as min/max power consumption, and peak amps, watts, etc.
get-wmiobject CIM_BIOSElement -namespace root\cimv2\dell -computer Server1 | select-object InstallDate, Name, Version Displays BIOS Version, and installation date
get-wmiobject CIM_BIOSElement -namespace root\cimv2\dell -computer Server1 | % {$_.ConvertToDateTime($_.InstallDate), $_.Name, $_.Version} Convert BIOS Install Date time to a friendly date/time
get-wmiobject DELL_Firmware -namespace root\cimv2\dell -computer Server1 | select-object Name, Version Displays DRAC Version information
get-wmiobject Dell_SoftwareFeature -namespace root\cimv2\dell -computer Server1 | select-object Description, OmsaURL, Version Displays the OMSAURL used to connect to DRAC
function LaunchDrac($strComputerName)
{
$a = get-wmiobject Dell_SoftwareFeature -namespace root\cimv2\dell -computer $strComputerName | select-object Description, OmsaURL, Version
$ie = new-object -comobject InternetExplorer.Application
$ie.visible = $true
$ie.navigate(($a.omsaurl.split(‘,’))[0])
}
sample Function to launch DRAC, based on computer name

Leave a Reply

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