/ucspe-ucsm-restore

A Microsoft PowerShell script that enables automating the restart of a Cisco UCS Platform Emulator (UCSPE) and restoring the UCS Manager configuration.

Primary LanguagePowerShell

Cisco UCSPE Restart and Restore

The Microsoft PowerShell script named ucspe_ucsm_restore.ps1 provided in this repository enables automating the restart of a Cisco UCS Platform Emulator (UCSPE) and then restoring the UCS Manager configuration. This can be useful for scenarios that require resetting the Cisco UCSPE to a known good state after being used for testing, training, demonstrations or development on UCS Manager.

Prerequisites:

  1. Microsoft Windows PowerShell 5 or above.
    NOTE: Earlier versions of PowerShell may be supported if the Cisco UCS PowerTool Suite is pre-installed.
  2. A running Cisco UCSPE virtual machine accessible over your network. More information and downloads for the Cisco UCSPE can be found here.
  3. A saved UCS Manager configuration backup file from the targeted UCSPE in an accessible storage location.
  4. [Optional] The Cisco UCS PowerTool Suite, available here.
    NOTE: If the Cisco UCS PowerTool Suite is not pre-installed, the Cisco.UCSManager PowerShell module will be automatically installed when running the ucspe_ucsm_restore.ps1 script.

Getting Started:

  1. Please ensure that the above prerequisites have been met.
  2. Download the ucspe_ucsm_restore.ps1 file from this repository here on GitHub.
  3. Document the IP address of the targeted Cisco UCSPE.
  4. Document the storage location path of the UCS Manager configuration backup file.

How to Use:

The ucspe_ucsm_restore.ps1 script provides the ability to perform an automated restart and UCS Manager configuration restore on a targeted UCSPE. The following is an example of command usage and mandatory parameters, in which the targeted UCSPE has an IP address of 192.168.1.7, the UCS Manager username is admin, the UCS Manager password is Cisco123, and the storage location path for the UCS Manager configuration backup file is "C:\Backups\UCS-Config-Backup.xml":

ucspe_ucsm_restore.ps1 -IP 192.168.1.7 -User admin -Password Cisco123 -BackupPath "C:\Backups\UCS-Config-Backup.xml"

The ucspe_ucsm_restore.ps1 script does not require the parameter names and will accept just the positional values. Here is an example:

ucspe_ucsm_restore.ps1 192.168.1.7 admin Cisco123 "C:\Backups\UCS-Config-Backup.xml"

Parameters:

-IP

The IP parameter is mandatory and specifies the IP address of the targeted UCSPE VM. A resolvable hostname for the targeted UCSPE will also be accepted for the value.

-User

The User parameter is mandatory and specifies the username of the credentials that will be used to log into UCS Manager.

-Password

The Password parameter is mandatory and specifies the password of the credentials that will be used to log into UCS Manager.

-BackupPath

The BackupPath parameter is mandatory and specifies the saved storage location of the UCS Manager configuration backup file.

-MinutesToWait

The MinutesToWait parameter is optional and specifies the number of minutes to wait for the UCSPE to restart before attempting to restore the UCS Manager configuration backup. The default setting is 4 minutes. Depending the version and resources (CPU, memory) allocated to the targeted UCSPE VM, the time needed to wait for the UCSPE to fully restart may more or less than the default 4 minutes. If this is the case, the MinutesToWait parameter can be added to the ucspe_ucsm_restore.ps1 script. Here is an example in which the wait time has been adjusted to 10 minutes:

ucspe_ucsm_restore.ps1 -IP 192.168.1.7 -User admin -Password Cisco123 -BackupPath "C:\Backups\UCS-Config-Backup.xml" -MinutesToWait 10

Notes and Caveats:

In some instances, a 503 error may be received when the UCS Manager configuration backup restore is attempted. This is an intermittent bug with the UCSPE and can be overcome by re-running the ucspe_ucsm_restore.ps1 script.

Use Cases:

A modified version of the script in this repository is a part of the automation used to support and enable the following Cisco Data Center product demonstrations on Cisco dCloud:

  1. Cisco UCS Management with Intersight v1
  2. Cisco UCS Central 2.0 v1
  3. Cisco UCS Central 2.0 Lab v1
  4. Cisco UCS Programmability and Automation Lab v1

Cisco dCloud is available at https://dcloud.cisco.com, where product demonstrations and labs can be found in the Catalog.

Author:

Ugo Emekauwa

Contact Information:

uemekauw@cisco.com or uemekauwa@gmail.com