cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8477
Views
8
Helpful
5
Comments
joemar
Level 4
Level 4

This PowerShell script loads the PowerTool module if needed and then auto launches your browser to the UCSM manager and executes the convert to UCSCmdLet so you can learn how to create PowerShell code elements for UCS easily.

The power of the ConvertTo-UcsCmdlet command is that it allows you to run it, do something in the UCSM GUI and after hitting SAVE in UCSM you can see the PowerShell command for that in your PowerShell Window.

Change Log:

     v1.1 - Initial Post

     v1.3 - Updated to support extended logging for more convertto-ucscmdlet functionality and added countdown timer to make sure log is ready.

     v1.4 - Checks to make sure you are running a minimum of PowerShell V3

     v0.4.01 - Changed to a version 0 dot as nothing of mine is a 1 dot :-)  Added built in help.  Command line options.  Standard naming convention.

     v0.4.02 - Added support for saved credentials file


As always, let me know if you have any questions, problems or suggestions.


Joe

Comments
srashidi
Level 1
Level 1

I am trying to use converto-IMCCmdlet to see command in Powetool or powerGUI , but I get below response, does  anybody know what I need to put as Managedobject?

cmdlet ConvertTo-ImcCmdlet at command pipel position 1

Supply values for the following parameters:

rrawal
Cisco Employee
Cisco Employee

ConvertTo-ImcCmdlet:-

 

Cisco IMC GUI does not support XML logging like UCSM. To generate Cmdlets, ConvertTo-IMC Cmdlet rely on the output of the Get cmdlet and generate Cmdlets to replicate the same object hierarchy.

 

Generate cmdlets for the specified MOs.

Example 1–

PowerTool C:\> Get-ImcRackUnit | ConvertTo-ImcCmdlet

 

#INFO: Review the generated cmdlets before deployment.

 

$rackUnit  = Get-ImcRackUnit -ServerId "1" | Set-ImcRackUnit -AdaptorSecureUpdate "Enabled" -AdminPower "up" -AssetTag "ABCD-1234" -ResetComponents "components" -UsrLbl "test-lbl2" –Force

 

Example 2 –

Get-ImcBiosSettings -Hierarchy | ConvertTo-ImcCmdlet

To Save the cmdlet output in file –

Get-ImcBiosSettings -Hierarchy | ConvertTo-ImcCmdlet -OutputPath "C:/OutputFile.txt"

 

For some more details and a small demo on the same please refer below link.

https://communities.cisco.com/docs/DOC-51321

srashidi
Level 1
Level 1

How about UCSM , I have seen some videos that they just run convertto-cmdlet, and it converts XML to Powertool commands, but when I run the covnertto-UCScmdlet I get same error that I need to "Supply values for the following parameters "

Would  be appreciated if you can provide some examples for UCSM

Thanks

rrawal
Cisco Employee
Cisco Employee

Hi,

 

First method is same as IMC as mentioned above. Just pass the get cmdlet to ConvertTo-UcsCmdlet and get the corresponding Add/Set cmdlet.

 

Another method is to record the XML log while doing the operations in HTML5 GUI and then pass the Logs to ConvertTo-UcsCmdlet and it will generate the corresponding cmdlets of the operations done on UI.

 

Steps to generate Logs from HTML 5 UI and passing it to convertto.

 

  • In the HTML 5 UI of UCSM, press Ctlr+Alt+Q twice.
  • “Record XML link” will appear on the top of the screen, a little right from the center.
  • Click the link and it will initiate the recording of GUI operations.
  • Do the operations you want to do on UI.
  • Once done with the operations on UI, click the same link which now says “Stop XML Recording”.
  • On clicking the link, a popup will come to provide the name for xml log and save.
  • Once the log is saved, same can be used with ConvertTo-UcsCmdlet as mentioned below.

 

ConvertTo-UcsCmdlet -Xml -LiteralPath C:\Users\administrator\Downloads\<RecordedFileName>

 

JoshuaPost65935
Level 1
Level 1

@rrawal  This is incredibly helpful!  I've not found any other references to CTRL+ALT+Q to get the Record XML option, but it works great.  This should be more publicly available!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links