In Part 3 of this series I cover a great cmdlet that’s really useful when first learning UCS PowerTool. It’s called ConvertTo-UCSCmdlet and what it does is translate actions in the Java GUI into PowerTool commands.
ConvertTo-UCSCmdlet monitors the java log file that the UCSM Java GUI creates when it’s run. When it sees a Change Event it outputs the equivalent PowerTool command to the PowerShell console. Using the Cmdlet is quite straight forward. First log into the Java GUI of UCSM.
Next head over to your PowerShell / PowerTool CLI and run ConvertTo-UcsCmdlet. You can run this cmdlet without needing to be connected to UCSM in PowerTool.
PowerTool C:\> ConvertTo-UcsCmdlet
You should see something similar to below. ConvertTo-UcsCmdlet is now monitoring the log file of the UCSM Java GUI session you opened up and will capture any Change Events. Leave the cmdlet running in the background.
Back in the Java GUI make a simple change. In the below example we add a new VLAN.
We create a new VLAN ID 13 and give it a name of 13 and click OK. If you can see your PowerTool session running in the background you will see the equivalent PowerTool command appear below the monitored log file.
Usually what you get back is a little more than you need to make a change in PowerTool. For example ConvertTo-UcsCmdlet also provides you with all the default parameters when creating a VLAN using Add-UcsVlan. While you could omit some of these parameters when normally working in PowerTool there’s no real harm in having them all in.
It’s also worth noting that ConvertTo-UcsCmdlet will only capture Change Events. It will not capture basic navigation inside the UCSM GUI.
I have found this to be a great cmdlet in learning UCS PowerTool. Especially when I don’t know how to do an equivalent command from the GUI inside PowerTool.