cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Quick Launch UCSM GUI PowerShell Script

3803
Views
7
Helpful
15
Comments

This script allows you to quickly launch the UCSM GUI.  It shows you how to create a secure credentials file to bypass the requirement to provide credentials to access the UCSM GUI.  Additionally it supports providing command line parameters for the IP Address/Hostname of a UCSM Domain and the location of the credentials file if not located with the script or named differently.

Change Log:

   v0.1.00 - Initially posted version

   v0.1.01 - Minor changes and fixes

   v0.1.02 - Added -nossl switch to launch UCSM GUI via HTTP instead of HTTPS.  You need to disable HTTP redirect in UCSM if you want to use this.

As always, please provide me any comments, concerns or suggestions!

Joe

Comments
Not applicable

Hi Joe,

I'm trying to run this script and it is failing to connect as shown here:

+++++++++++++++++++++++++++++++++

Script Running...

This script will launch the UCSM GUI rapidly by

allowing the user to only specify the UCSM address

and use a saved credentials file

To create a saved credentials file do the following:

    $credential = Get-Credential

    $credential | select username,@{Name="EncryptedPassword";Expression={ConvertFrom-SecureString $_.password}} | Exp

ort-CSV -NoTypeInformation .\myucscred.csv

Checking Cisco PowerTool

    PowerTool version 1.2.1.0 is already Loaded

Enter UCS system IP or Hostname: 172.31.1.230

Testing PING access to UCSM

    Can not access UCSM 172.31.1.230 by Ping

        It is possible that a firewall is blocking ICMP (PING) Access.  Would you like to try to log in anyway?

Would you like to try to log in anyway? (Y/N): Y

                Will try to log in anyway!

Failed to Connect

Retry (Y/N): Y

+++++++++++++++++++++++++++++++++

I've created some generic creds and used your Get-Credential process script to build the myucscred.csv file.  The Windows authentication dialog box pop'ed up and I entered my User name and Password.   If  I open the  myucscred.csv file in Excel  - I see my username "admin" Column A / Row 1 and my password "P@ssw0rd"  in Column B / Row 1 and then some lengthy hash starting from Column B Row 2.

I am able to authenticate with those generic creds via the UCSM GUI and SSH - so I know its not a credential failure. 

My job has changed within our company and my focus is now exclusively on UCS Management and Monitoring and clearly I'll have to become much more familiar with Powershell and the Cisco Powertool plugin.   

This engineer has produced a wonderful script that enumerates the UCS B Series inventory:

http://lostdomain.org/2014/06/30/cisco-ucs-inventory-script/

Thanks for your time.

Amir

Cisco Employee

Amir,

Did you use exactly the following snippet to store the credentials to the file?

$credential = Get-Credential

$credential | select username,@{Name="EncryptedPassword";Expression={ConvertFrom-SecureString $_.password}} | Export-CSV -NoTypeInformation .\myucscred.csv

If you use it, then the column 1 will have the username and column2 the encrypted password. Row 1 will be the header and the Row 2 will be the values.

Enthusiast

As Reswaran call out row 2 should be an encrypted password.  It will be LONG.  It should not be your password in clear text.

Another thing to call out is once this file is created it can only be run on the computer that generated it.  If you have multiple workstations you will need to create the file on each.

Finally I noticed in your script snippit that the 'ping' test failed.  Are you SURE you are connected to the UCSM.  Are you able to open the UCSM web page from your workstation.

Not applicable

Hi reswaran / Joe,

This was user error as I actually edited the csv and input my username and my password values directly into it.  I didn't realize that I should just drop the two statements directly into the Powershell interface.

I deleted my original *.csv file and then dropped the two statements into powershell and got a little further as seen below.  The problem now is that USCM never actually "opened".

To answer Joe's question - I definitely have IP connectivity to the UCSM.  This is my lab environment and as I work remotely - there are numerous firewalls in place - thus the ICMP failure.

Script Running...

This script will launch the UCSM GUI rapidly by

allowing the user to only specify the UCSM address

and use a saved credentials file

To create a saved credentials file do the following:

    $credential = Get-Credential

    $credential | select username,@{Name="EncryptedPassword";Expression={ConvertFrom-SecureString $_.password}} | Exp

ort-CSV -NoTypeInformation .\myucscred.csv

Checking Cisco PowerTool

    Loading Module: Cisco UCS PowerTool Module

        PowerTool version 1.2.1.0 is now Loaded

Enter UCS system IP or Hostname: 172.31.1.230

Testing PING access to UCSM

    Can not access UCSM 172.31.1.230 by Ping

        It is possible that a firewall is blocking ICMP (PING) Access.  Would you like to try to log in anyway?

Would you like to try to log in anyway? (Y/N): y

                Will try to log in anyway!

You are connected to UCSM: 172.31.1.230(usa109-6120fab01)

    Launching UCSM GUI

Start-ucsguisession : Object reference not set to an instance of an object.

At C:\Users\asafayan\Desktop\Start-UcsGui.ps1:226 char:17

+                 $myConGUI = Start-ucsguisession -LogAllXml -ErrorAction Stop

+                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Start-UcsGuiSession], NullReferenceException

    + FullyQualifiedErrorId : Cisco.Ucs.Cmdlets.StartUcsGuiSession

PS C:\Users\asafayan\Desktop>

Enthusiast

I looked over my script and I cannot reproduce the issue you are having.  I even upgraded by PowerTool module to the same version.  I can only ask a few questions.

1 - What version is the UCSM?

2 - What version of Java do you have installed?

Not applicable

Hi Joe,

1. 2.2(1d) as shown here:

2. Java 7 Update 25

Thanks,

Amir

Enthusiast

Those should work.  I'm sorry but I don't know 'why' this isn't working for you.  Can you confirm that you can open the UCSM GUI through the web page?

Not applicable

I can definitely open the UCSM GUI.  Let's leave it as one of life's unanswered questions! : )

Thanks for your time,

Amir

Cisco Employee

Please run ‘connect-ucs -xml’ in powertool window and send the o/p.

Not applicable

Hi Reswaran,

Very grateful for your diligence on this.  Here is the ouput:

Community Member

Joe, I can get the script to generate the myucscred file but it's not using my creds to open UCSM.  I'm still being prompted for username and password.  Thoughts?

Enthusiast

Jonathan, sorry for my late reply but I'm just back from a 3 month leave.  Did you get this working?  Do you need assistance?

Community Member

Hi Joemar,

I am getting below error while running the script. Could you please help on this.

Disconnect-Ucs : The term 'Disconnect-Ucs' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling

of the name, or if a path was included, verify that the path is correct and try again.

At C:\Users\e3016726\Desktop\Start-UcsGui\Start-UcsGui.ps1:99 char:3

+         Disconnect-Ucs

+         ~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (Disconnect-Ucs:String) [], ParentContainsErrorRecordException

    + FullyQualifiedErrorId : CommandNotFoundException

Enthusiast

Hi Nandeesh,

What is the version of PowerTool you are using? If you are using UCS PowerTool Suite 2.0.1 then you need to update the script before using it. The PowerTool module names are changed in 2.0.1 release.

The following table lists the module name changes in this release:

Previous Module Name

New Module Name

CiscoUcsCentralPS

Cisco.UCSCentral

CiscoImcPS

Cisco.IMC

CiscoUcsPS

Cisco.UCSManager

You need to replace CiscoUcsPs to Cisco.UcsManager in all the places in the script.

Let us know if you need further assistance on this.

Thanks,

Sumanth

Community Member

Thank you very much, Script is working fine.

Hi joemar

I need multiple Pods to be login at the same time without asking IP address.  The IP address should be per-defined. so that once we execute the script we should get the UCSM.

Please help on this.

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards
This widget could not be displayed.