Introduction Powershell is not a tool limited to Windows world any more. Cisco offers its own PowerShell module, PowerTool, to manage UCS. In this lab
Powershell is not a tool limited to Windows world any more. Cisco offers its own PowerShell module, PowerTool, to manage UCS. In this lab, PowerTool is to be installed on a Windows machine, which has accessibility to UCS manager. UCS Platform Emulator (UCSPE) is installed to simulate UCSM including a Fabric Interconnect pair (FI-A and FI-B) and UCS-B servers.
PowerTool can also be integrated with UCS Director (UCSD), the Cisco automation and orchestration tool. UCSD can call PowerShell Agent (PSA) server remotely and provide a GUI service catalog to users. In addition, VMWare also has its own PowerShell module. AWS serves another example. I may write blogs on those usage in future, but they are out of scope of the current series.
There is a post in Cisco community to distribute UCSPE images and documentations: https://communities.cisco.com/docs/DOC-37827
Alternatively, to download the OVA or Zip files for UCS PE 3.1(1e), please use the following links:
UCS PE 3.1(1e) OVA file: https://cisco.box.com/s/u788fd8fs4epe3urqtegshhdqon104ei
UCS PE 3.1(1e) zip file: https://cisco.box.com/s/wxtlw1xkbxzzzoqwj7t3eh5tnx1ni0pl
Cisco UCSM PowerTool22.214.171.124:
Cisco PowerTool can be downloaded from: https://software.cisco.com/download/release.html?mdfid=286282669&flowid=72562&softwareid=284574017&release=1.5.3&relind=AVAILABLE&rellifecycle=&reltype=latest
1. Install UCSPE3.1(1e)OVA
I installed UCSPE OVA on VMWare ESXi5.5 this time. I also successfully installed it on VMware Workstation and VMware Player before; virtual box has not been tested yet.
It is a pretty straight forward installation, the VM specs are as below:
2. Initial Setup UCSPE
After UCSPE OVA is successfully installed, basic configuration is required, FI-A IP, FI-B IP and VIP in particular.
UCSPE’s default username and password is ‘ucspe/ucspe‘.
Upon login with the default username and password, the following manual appears, where network settings can be configured.
After setting up FI-A, FI-B and VIP, I can access UCSM’s VIP via HTTP using the default username and password (ucspe/ucspe) as below:
3. Install Cisco PowerTool on Windows
PowerTool is an exe file to be run on Windows machine with PowerShell. The installation works fine with Windows 7,8 and Windows server 2012R2. However, when I tried to install it on Windows2008R2, it did throw me an error: [One or more instances of PowerShell are running. Close them and click “Retry” to try again.] Sure I know no other PowerShell instance was running when PowerTool was installed. It may due to short of some plugins etc., which I didn’t spent time investigating.
Cisco PowerTool will be installed at ‘C:\Program Files (x86)\Cisco\Cisco UCS PowerTool’ folder. You can run it directly by ‘Cisco UCS Manager PowerTool’ or import it as module in PowerShell and run the PowerTool commands from normal PowerShell. I highly recommend the later due to central managing and executing PS commands.
To import Cisco PowerTool as a module to PowerShell, we execute the command ‘import-module CiscoUcsPs’. The list of imported modules can be view by executing ‘get-module’.
You may encounter an error as below saying script cannot be loaded because running scripts is disabled on this system. It is a common beginner gotcha. By default the script execution policy is set as ‘restricted’, which means no scripts can be run. I loose the execution policy to ‘unrestricted’ to allow all PS scripts to be run. Detailed explanation is available from Microsoft documentation ‘Using the Set-ExecutionPolicy Cmdlet‘
After we set the execution policy as ‘unrestricted’, CiscoUCsPs module is successfully executed and ‘connect-ucs’ command is available now.
4. Connect UCSM from PowerShell
I can now issue command ‘Connect-Ucs [UCSM VIP]’ from PowerShell to connect UCSM. An authentication window will pop up as below, requiring UCSM username and password. I used UCSPE default username and password ‘ucspe/ucspe’.
After successfully login, the following UCSM information appears:
If you cannot log into UCSM, check the following:
- Credentials – you can use GUI access to test credentials;
- PowerShell machine to UCSM connectivity, e.g. ping. The authentication windows will pop up regardless the connectivity exists or not, therefore cannot be used as test method; and
- Windows firewall settings.
After connecting to the designated UCSM, I can use PowerShell command to retrieve information or perform configuration. Following is an example:
Native PowerShell commands also work. For example, ‘get-command -name *ucs*’ lists all commands with ‘ucs’ included in the command name.
To be continued
You now know how to setup the UCSM lab, use PowerShell to connect and manage UCSM. The next blog will show you the PowerShell editor I use to make script writing and testing easier. More importantly, a full script that I developed before to build UCS-B from scratch, with one click.
I found script is helpful when we have to deploy multiple UCS-B chassises and/or engineer is lack of UCSM experience – not easy to understand the hierarchical structure and where to find stuff. iSCSI may be an example.
I will also try to articulate how UCSM works based on my script. If I don’t finish the rest of the series quick…means I may be overwhelmed by work, gym and/or World of Warcraft 🙂