Overview


This article explains how to build and execute WSMAN method (invoke) commands for Dell PowerEdge servers with iDRAC7. It shows the syntax for WinRM commands on Windows management stations and OpenWSMAN commands on Linux management stations.

Methods are documented in Chapter 8 of the Dell profile documents. Methods are written in the format:

ClassName.MethodName()

The Dell profile documents are posted here:

DCIM.Library.Profile


Example 1 - Single Parameter Method Command

The method used in this example is from the BaseServer & Physical Asset profile. It is the RequestStateChange() method in the DCIM_ComputerSystem class and is written as DCIM_ComputerSystem.RequestStateChange(). This method can be used to power on, power off, or reset the server.

Step 1 - Check the Profile Document

The following screenshot is from Chapter 8 of the Base Server & Physical Asset profile document:

To execute the RequestStateChange() method, per table 20 we must supply a parameter named RequestedState, which must have a value of 2, 3, or 11 depending on the desired action.

Step 2 - Build the Method Command

1.       Enumerate the class associated with the method, DCIM_ComputerSystem, & find the keys (also referred to as selectors) using the epr switch:


WinRM syntax - Windows management stations

winrm e cimv2/root/dcim/DCIM_ComputerSystem -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic -returntype:epr


OpenWSMAN syntax - Linux management stations

wsman enumerate http://schemas.dell.com/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_ComputerSystem -u root -p calvin -h 172.23.200.117 -P 443 -c Dummy -y basic -V –v –M epr

Note: The credentials (user name and password) and IP address used in all commands are those assigned to the iDRAC7 of the managed PowerEdge server.

The command above will return the keys (or selectors):

Selector: __cimnamespace = root/dcim, CreationClassName=DCIM_ComputerSystem, Name=srv:system

2.       Using the keys, build a get command to confirm the syntax. This step is not required, but recommended since the invoke command will add to this command and syntax errors are easy to make. The __cimnamespace key is not required.


WinRM syntax:

winrm g cimv2/root/dcim/DCIM_ComputerSystem?CreationClassName=DCIM_ComputerSystem+Name=srv:system -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic


OpenWSMAN syntax:

wsman get http://schemas.dell.com/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_ComputerSystem?CreationClassName="DCIM_ComputerSystem",Name="srv:system" -h 172.23.200.117 -P 443 -u root -p calvin -c Dummy -y basic -V –v


Run the appropriate get command above to confirm the syntax is correct.

3.       Convert the get command to a method command by changing "get" to "invoke" ("g" to "i"), and add the method name, RequestStateChange. At the end of the command add the input parameter(s) and values per the profile document. Per Table 20 in the profile document (screenshot above) the parameter name is RequestedState and possible values are 2,3, or 11. The following example uses the value 2 (2 = Enabled, or Power On the system).


WinRM syntax:

winrm i RequestStateChange cimv2/root/dcim/DCIM_ComputerSystem?CreationClassName=DCIM_ComputerSystem+Name=srv:system -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic @{RequestedState="2"}


OpenWSMAN syntax:

wsman invoke -a "RequestStateChange" http://schemas.dell.com/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_ComputerSystem?CreationClassName="DCIM_ComputerSystem",Name="srv:system" -h 172.23.200.117 -P 443 -u root -p calvin -c Dummy -y basic -V –v -k "RequestedState=2"

Step 3 - Run the Command

 

The following screenshot shows the same method command using different parameter values and the output returned:




 

Example 2 - Multi-Parameter Method Commands

 

Some commands require or have the option to specify multiple parameters. This can be done by specifying all parameters in the command line or pointing to an .xml file as input. 

These are examples of the syntax with multiple parameters and optional .xml file that can be used.

Note: The parameters and values shown in this example are just to illustrate the syntax and .xml file format when multiple parameters are used. Actual parameters and values will vary based on your system configuration. These examples were developed using the Dell RAID profile document. To run successfully, the RAID configuration commands require the iDRAC7 to be at an Express or Enterprise license level.

Option 1 - Specifying All Parameters in the Command

WinRM syntax:

winrm i GetAvailableDisks cimv2/root/dcim/DCIM_RAIDService?SystemCreationClassName=DCIM_ComputerSystem+CreationClassName=DCIM_RAIDService+SystemName=DCIM:ComputerSystem+Name=DCIM:RAIDService -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic @{Target="RAID.Integrated.1-1";DiskType="0";DiskProtocol="0";DiskEncrypt="0";RAIDLevel="4"}


OpenWSMAN syntax:

wsman invoke -a "GetAvailableDisks"  http://schemas.dell.com/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_RAIDService?SystemCreationClassName="DCIM_ComputerSystem",CreationClassName="DCIM_RAIDService",SystemName="DCIM:ComputerSystem",Name="DCIM:RAIDService" -h 172.23.200.117 -P 443 -u root -p calvin -c Dummy -y basic -V -v -k "Target=RAID.Integrated.1-1" -k "DiskType=0" -k "DiskProtocol=0" -k "DiskEncrypt=0" -k "RAIDLevel=4"

Option 2 - Putting the Parameters in an .xml File

WinRM Syntax:

winrm i GetAvailableDisks cimv2/root/dcim/DCIM_RAIDService?SystemCreationClassName=DCIM_ComputerSystem+CreationClassName=DCIM_RAIDService+SystemName=DCIM:ComputerSystem+Name=DCIM:RAIDService -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic -file:gad.xml

OpenWSMAN Syntax:

wsman invoke -a "GetAvailableDisks"  http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_RAIDService?SystemCreationClassName="DCIM_ComputerSystem",CreationClassName="DCIM_RAIDService",SystemName="DCIM:ComputerSystem",Name="DCIM:RAIDService" -h 172.23.200.117 -P 443 -u root -p calvin -c Dummy -y basic -V -v -J gad.xml

 

XML file (gad.xml) contents:

 

<p:GetAvailableDisks_INPUT xmlns:p="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/root/dcim/DCIM_RAIDService">

<p:Target>RAID.Integrated.1-1</p:Target>

<p:DiskType>0</p:DiskType>

<p:Diskprotocol>0</p:Diskprotocol>

<p:DiskEncrypt>0</p:DiskEncrypt>

<p:RaidLevel>4</p:RaidLevel>

</p:GetAvailableDisks_INPUT>

 

Note: The schema specified in the .xml file must match the schema in the command.  For example, you can't use schemas.dell.com in the command and schemas.dmtf.org in the .xml file it references or the command will fail. For WinRM commands, "cimv2" is an alias that contains schemas.dmtf.org.

 

Example 3 - Set Attribute Methods

The concept for SetAttribute methods is the same as other methods. However, these methods also involve jobs. This example will cover the DCIM_iDRACCardService.SetAttribute() method described in the iDRAC Card profile document. Commands shown in this example will be WinRM only. For conversion to OpenWSMAN syntax, see the examples above.

In this example we will change the CurrentValue property of the DefaultCredentialMitigation attribute from Enabled to Disabled.

Notes: The DefaultCredentialMitigation attribute is in iDRAC7 firmware version 1.30.30 or later. For the SetAttribute method commands to run successfully, the iDRAC7 must be at an Express or Enterprise license level.

Check the Profile Document


Chapter 8 of the iDRAC Card profile document shows the following table for the SetAttribute() method:


 To execute the SetAttribute() method, per table 86 we must supply three parameters:

  1. Target - the FQDD
  2. AttributeName  - formatted as <GroupID  property value>#<AttributeName property value>
  3. AttributeValue - the new value

We need to find out which class to enumerate to get the DefaultCredentialMitigation attribute information required in table 86. Searching the profile doc for "credential" we find this section:


From the above, we see that we can get the information needed by enumerating DCIM_iDRACCardEnumeration, & finding instance with the AttributeName=DefaultCredentialMitigation. The possible values we can set are "Enabled" & "Disabled".

Determine the Parameter Values


Enumerate DCIM_iDRACCardEnumeration with the following command:

winrm e cimv2/root/dcim/DCIM_iDRACCardEnumeration -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic > idrac_enum.txt

Since the DCIM_iDRACCardEnumeration class contains a lot of data, we sent the output to a text file (idrac_enum.txt). This makes it easier to search for the instance we are looking for.  The instance we need is found in the text file output as follows:

This output contains everything we need to build the invoke command. The items highlighted are the ones needed per the profile document.  

Build the Invoke command

1.       Enumerate the class that contains the SetAttribute() method (DCIM_iDRACCardService per chapter 8 of the iDRAC Card profile document) & find the keys using the -returntype: epr switch:

winrm e cimv2/root/dcim/DCIM_iDRACCardService -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic -returntype:epr

 

The command above will return the keys:

Selector: __cimnamespace = root/dcim, SystemCreationClassName = DCIM_ComputerSystem, SystemName = DCIM:ComputerSystem, CreationClassName = DCIM_iDRACCardService, Name = DCIM:iDRACCardService


2.       Using the keys, build a get command to confirm the syntax. This step is not required, but recommended since the invoke command will add to this command and syntax errors are easy to make. The __cimnamespace key is not required.

winrm g cimv2/root/dcim/DCIM_iDRACCardService?SystemCreationClassName=DCIM_ComputerSystem+SystemName=DCIM:ComputerSystem+CreationClassName=DCIM_iDRACCardService+Name=DCIM:iDRACCardService -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic

Run the appropriate get command above to confirm the syntax is correct.

3.       Convert the get command to a method command by changing "get" to "invoke" ("g" to "i"), and add the method name, SetAttribute. At the end of the command add the input parameter(s) and values per the profile document (optionally, an .xml file could be used as shown earlier). Per Table 86 in the profile document (earlier screenshot) we need:

a.       Target="iDRAC.Embedded.1" (the FQDD)

b.      AttributeName="DefaultCredentialMitigationConfigGroup.1#DefaultCredentialMitigation"  (The GroupID & AttributeName, separated by a #)

c.       AttributeValue="Disabled" (we are changing the CurrentValue property from Enabled to Disabled).

The resulting command is as follows:

winrm i SetAttribute cimv2/root/dcim/DCIM_iDRACCardService?SystemCreationClassName=DCIM_ComputerSystem+SystemName=DCIM:ComputerSystem+CreationClassName=DCIM_iDRACCardService+Name=DCIM:iDRACCardService -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic @{Target="iDRAC.Embedded.1";AttributeName="DefaultCredentialMitigationConfigGroup.1#DefaultCredentialMitigation";AttributeValue="Disabled"}

Execute the Method & Set the Pending Value

The command appears as follows when run:


Note that the SetResult indicates PendingValue was set, not the CurrentValue. This can be verified by enumerating the DCIM_iDRACCardEnumeration class to see the values with the command:


winrm e cimv2/root/dcim/DCIM_iDRACCardEnumeration -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic > idrac_enum.txt

The output for the instance we need is found in idrac_enum.txt as follows:


Note that the PendingValue has changed from null to Disabled, and the CurrentValue is still set to Enabled.


Create and Run a Job to Set the Current Value

To apply the PendingValue (and make it the CurrentValue) we must create and run a job. This is done with the CreateTargetedConfigJob() method. The following is also from Chapter 8 of the iDRAC Card profile document:


The command to create the job and run it immediately is:

winrm i CreateTargetedConfigJob cimv2/root/dcim/DCIM_iDRACCardService?SystemCreationClassName=DCIM_ComputerSystem+SystemName=DCIM:ComputerSystem+CreationClassName=DCIM_iDRACCardService+Name=DCIM:iDRACCardService -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic @{Target="iDRAC.Embedded.1";ScheduledStartTime="TIME_NOW"}


The output appears as follows:



You can check the Job Status by enumerating DCIM_LifeCycleJob and looking for the Job ID:

To verify the PendingValue of Disabled has been applied to the CurrentValue, you may enumerate DCIM_iDRACCardEnumeration again:

winrm e cimv2/root/dcim/DCIM_iDRACCardEnumeration -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic > idrac_enum.txt


The output for the instance we need is now:

The PendingValue has gone back to null & the CurrentValue is now set to Disabled.


Other Job-Related Methods

These additional two methods are useful when working with SetAttribute methods and jobs.

Delete a Pending Configuration (Example from the iDRAC Card profile):

winrm i DeletePendingConfiguration cimv2/root/dcim/DCIM_iDRACCardService?SystemCreationClassName=DCIM_ComputerSystem+SystemName=DCIM:ComputerSystem+CreationClassName=DCIM_iDRACCardService+Name=DCIM:iDRACCardService -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic @{Target="iDRAC.Embedded.1"}


Clear the Job Queue (This method is described in the Job Control profile):

winrm i DeleteJobQueue cimv2/root/dcim/DCIM_JobService?Name=JobService+CreationClassName=DCIM_JobService+SystemName=Idrac+SystemCreationClassName=DCIM_ComputerSystem -u:root -p:calvin -r:https://172.23.200.117/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:basic @{JobID="JID_CLEARALL"}

Related Articles 

WSMAN - Windows / Linux Command Conversion

Web Services Management (WS-MAN) Windows Client Setup

Web Services Management (WSMAN) Linux Client Installation & Setup

 

This article written by Jim Slaughter.