Examples

This chapter contains the following sections:

PowerTool Cmdlet Generation

The ConvertTo-UcsCentralCmdlet enables you to learn about the PowerTool cmdlets that performs configuration action by generating the cmdlet in one of the following ways:

  • Performing actions in GUI
  • From a backup file
  • From a UCS Central PowerShell object

Generate Cmdlets From UCS Central GUI Actions

Before you begin

  • Install Flash Debugger (not flash player) for your web browser. You can download the software from this URL: https://www.adobe.com/support/flashplayer/downloads.html

    Note

    Flash debuggers are different for different browsers. For example, Internet Explorer has a different flash debugger than Mozilla Firefox.


  • Configure mm.cfg file located under user directory. For example, if there is a username demoUser on the windows system, the file is located in the "C:\Users\demoUser" path. This file provides instructions to the Flash Debugger about settings related to log dumping. Modify the following properties as:
  • ErrorReportingEnable=1

    TraceOutputFileEnable=1

    If there is no mm.cfg file, you can create one and follow the link to editor configure mm.cfg file:

    http://helpx.adobe.com/flash-player/kb/configure-debugger-version-flash-player.html

Procedure


Step 1

After the UCS Central GUI launches, at the login page, press Ctrl + Alt + Shift+L. The Logger Console flash popup is displayed. Modify the logger preferences as follows:

  1. Select the Trace option for the property Destination.

  2. Click the Set Log Preference button.

Step 2

Enter the username and password for UCS Central and log on to UCS Central.

A log file is created in the log file location depending on the OS. For more information on the exact location of the log files, see https://helpx.adobe.com/flash-player/kb/configure-debugger-version-flash-player.html. The name of the log file is the name mentioned in the property TraceOutputFileName in mm.cfg. If this property does not exist, the name is flashlog.txt.

Note 

If there is no Logs folder, create a Logs folder and repeat steps 1 and 2.

Step 3

Launch UCS Central PowerTool and run the ConvertTo-UcsCentralCmdlet.

This cmdlet monitors the configuration logs in the log file.

Step 4

Perform operations in the GUI.

The cmdlets for actions performed in the web UI is generated in the PowerTool console.


For Google Chrome Users

Perform the following steps to disable the integrated flash player and to install the flash debugger:

Procedure

Step 1

Install Flash debugger that is compatible with the Netscape browser.

Step 2

Select chrome://plugins and click the "[+] Details" icon, located at the top right corner of the screen.

Step 3

Search for the Shockwave Flash or Flash option.

Step 4

Disable the integrated version installed under the Chrome directory on your local machine.

For example, C:\Program Files (x86)\Google\Chrome\Application\39.0.2171.71\PepperFlash\pepflashplayer.dll

Step 5

Enable the Netscape compatible Flash Debugger which you installed in the Systems directory on your local machine.

For example, C:\Windows\SysWOW64\Macromed\Flash\NPSWF32_15_0_0_239.dll.

Step 6

Restart the Google Chrome browser.


Generate Cmdlets from UCS Central HTML GUI

Procedure

Step 1

Open UCS Central Web UI.

Step 2

From the Setting icon, select Start Logging Session to enable logging.

Perform the operations in the web UI.

Step 3

From the Setting icon, select Stop Logging Session to stop the session.

Step 4

Click Save at the prompt to save the logs in a file on your local system.

For example, C:\work\UcsCentralLog.txt.

Step 5

Launch UCS Central PowerTool and run the ConvertTo-UcsCentralCmdlet.

ConvertTo-UcsCentralCmdlet -GuiLog -Path "C:\work\UcsCentralLog.txt"

ConvertTo-UcsCentralCmdlet -GuiLog -LiteralPath C:\api-report.txt


Generate Cmdlets From Backup file

The following example is used to generate cmdlet from a backup file.

Generate cmdlets from backup file:

ConvertTo-UcsCentralCmdlet -UcsCentralBackup -LiteralPath "C:\central-mgr.xml" -OutputPath "C:\central-mgr.txt"

Generating Cmdlets From UCS Central PowerShell Object

Generate the cmdlets through piping the UCS Central objects from a Get cmdlet to the ConvertTo cmdlet. In the following example, ConvertTo cmdlet generates the cmdlets required to re-create the 'testSP' service profile object.

Generate cmdlets for the specified managed object

Get-UcsCentralServiceProfile -Name testSP | ConvertTo-UcsCentralCmdlet

Org

Get a list of orgs across Cisco UCS Central systems, in the Default UCS Central list.


Get-UcsCentralOrg | select UcsCentral, Name, Dn

Get a handle to the root level Org.


Get-UcsCentralOrg -Level root

Add five orgs to UCS.


1..5 | % { Add-UcsCentralOrg -Ucs <handle or name> qwerty$_ }

Faults

Retrieve faults, group them by severity.


Get-UcsCentralFault | group Severity

Retrieve critical faults.


Get-UcsCentralFault -Severity critical | select UcsCentral, Dn, Cause

Get Cmdlet -Hierarchy Flag

Get Managed Object including all children.


Get-UcsCentralComputeRequirement -Name sp_name -Hierarchy

Get Cmdlet -LimitScope Flag

Get service profile at the root level without descending into org root children.


Get-UcsCentralComputeRequirement -Name sp_name –LimitScope

Get Cmdlet -UCSCentralPolicyUsage

Get the policy usage details for Managed Object.

Get-UcsCentralOrg -Level root | Get-UcsCentralServiceProfile 
-Name "SPTemplate" -LimitScope | Get-UcsCentralPolicyUsage

Transaction Support

Start a transaction.


Start-UcsCentralTransaction

Perform operation.

....

End a transaction.


Complete-UcsCentralTransaction

Undo a transaction.


Undo-UcsCentralTransaction

UUID Suffix Pools

Create a UUID Suffix pool.


Add-UcsCentralUuidSuffixPool -Name uuid_pool -Prefix 2EEB8026-9084-11E1

Add a block of UUID Suffixes to the suffix pool.


Get-UcsCentralUuidSuffixPool -Name uuid_pool | Add-UcsCentralUuidSuffixBlock -From 0000-000000000001 -To 0000-00000000002C

Remove a UUID Suffix pool.


Get-UcsCentralUuidSuffixPool -Name uuid_pool | Remove-UcsCentralUuidSuffixPool

MAC Pools

Create a MAC pool.


Add-UcsCentralMacPool -Name mac_pool

Add a block of mac to the mac pool.


Get-UcsCentralMacPool -Name mac_pool | Add-UcsCentralMacMemberBlock -From 00:25:B5:00:00:00 -To 00:25:B5:00:00:09

Remove a mac pool.


Get-UcsCentralMacPool -Name mac_pool | Remove-UcsCentralMacPool

WWNN Pools & Blocks

Get all WWNN pool in UCS Central.


Get-UcsCentralWwnPool -Purpose node-wwn-assignment

Create a WWNN pool.


$wwnn_pool = Add-UcsCentralWwnPool -Name wwnn_pool -Purpose node-wwn-assignment

Add a WWN block to the WWNN pool.


$wwnn_pool | Add-UcsCentralWwnMemberBlock -From 20:00:00:24:B5:00:00:00 -To 20:00:00:24:B5:00:00:09

Remove a WWNN pool.


$wwnn_pool | Remove-UcsCentralWwnPool

WWPN Pools & Blocks

Get all WWPN pool in UCS Central.


Get-UcsCentralWwnPool -Purpose port-wwn-assignment

Create a WWPN pool.


$wwpn_pool = Add-UcsCentralWwnPool -Name wwpn_pool -Purpose port-wwn-assignment

Remove a WWPN pool.


$wwpn_pool | Remove-UcsCentralWwnPool

Clone a Service Profile

Copies a service profile.


Get-UcsCentralServiceProfile -Name “demoSP” | Copy-UcsCentralServiceProfile -DestinationOrg 
(Get-UcsCentralOrg -Level root) -NewName “clonedSP”

Add Service Profile Using Service Profile Template

Adds new service profiles using an existing service profile template.

Get-UcsCentralOrg -Level root | Get-UcsCentralServiceProfile 
-Type initial-template -name “SPTemplate” -LimitScope | 
Add-UcsCentralServiceProfileFromTemplate -NamePrefix @("ManualSP01","ManualSP02") 
-DestinationOrg "org-root"

Get-UcsCentralOrg -Level root | Get-UcsCentralServiceProfile 
-Type initial-template -name “SPTemplate” -LimitScope | 
Add-UcsCentralServiceProfileFromTemplate -Prefix "Simple" 
-Count "1" -DestinationOrg "org-root"

Rename Service Profile

Renames existing service profile.


Get-UcsCentralServiceProfile -name “spName” | Rename-UcsCentralServiceProfile -NewName "spNewName"

Associate Service Profile

Associates a service profile to a server pool or blade or rack servers.


Get-UcsCentralServiceProfile -Name “demoSPName” | Connect-UcsCentralServiceProfile -Blade (Get-UcsCentralBlade -SlotId 1)

Disassociate Service Profile

Renames existing service profile.


Get-UcsCentralServiceProfile -Name “demoSPName” | Disconnect-UcsCentralServiceProfile -Force

Configuration Backup

Remove any previously stored backups in UCS Central.



Get-UcsCentralMgmtDataExporter | Remove-UcsCentralMgmtDataExporter

The PathPattern can be autofilled, allowing the cmdlet to be used with multiple Cisco UCS Central domains. Create and download full-state system backup of UCS Central. Binary file that includes a snapshot of the entire system is created. You can use the file generated from this backup to restore the system during disaster recovery. This file can restore or rebuild the configuration on the new UCS Central VM. You cannot use this file for an import.


Backup-UcsCentral -Type full-state -PathPattern 'C:\Backups\${UcsCentral}-${yyyy}${MM}${dd}-${HH}${mm}-full-state.tgz'

Create and download logical backup of UCS Central. An XML file that includes all logical configuration settings such as service profiles, VLANs, VSANs, pools, and policies are created. You can use the file generated from this backup to import these configuration settings to the UCS Central. You cannot use this file for a system restore.


Backup-UcsCentral -Type config-logical -PathPattern 'C:\Backups\${UcsCentral}-${yyyy}${MM}${dd}-${HH}${mm}-config-logical.tgz'

Create and download system backup of UCS Central. An XML file that includes all system configuration settings such as usernames, roles, and locale is created. You can use the file generated from this backup to import these configuration settings to the UCS Central. You cannot use this file for a system restore.


Backup-UcsCentral -Type config-system -PathPattern 'C:\Backups\${UcsCentral}-${yyyy}${MM}${dd}-${HH}${mm}-config-system.tgz'

Create and download config-all backup of UCS Central. An XML file that includes all system and logical configuration settings is created. You can use the file generated from this backup to import these configuration settings to the UCS Central. You cannot use this file for a system restore. This file does not include passwords for locally authenticated users.


Backup-UcsCentral -Type config-all -PathPattern 'C:\Backups\${UcsCentral}-${yyyy}${MM}${dd}-${HH}${mm}-config-all.tgz'

Import Configuration

The import function is available for all configuration, system configuration, and logical configuration files. You can perform an import while the system is up and running.

Import all configuration XML (An XML file that includes all system and logical configuration settings. The current configuration information is replaced with the information in the imported configuration file one object at a time.

Import-UcsCentralBackup -LiteralPath 'C:\Backups\config-all.tgz'

Import all configuration XML. The information in the imported configuration file is #compared with the existing configuration information. If there are conflicts, the import operation overwrites the information on the Cisco UCS Central domain with the information in the import configuration file.

Import-UcsCentralBackup -LiteralPath 'C:\Backups\config-all.tgz' -Merge

Tech Support

Technical support data for the entire UCS Central instance is created and downloaded to the specified file.


Get-UcsCentralTechSupport -PathPattern 'C:\${UcsCentral}-techsupp-ucsc.tar' –All -RemoveFromUcsCentral -TimeoutSec 600

Technical support data for the Operation Manager provider is created and downloaded to the specified file.


Get-UcsCentralTechSupport -PathPattern 'C:\${UcsCentral}-techsupp-opmgr.tar' -OperationMgr -RemoveFromUcsCentral -TimeoutSec 600

Filters

Get all Local Service Profiles with Name containing string 'SJC'.


Get-UcsCentralComputeRequirement -Filter 'Name -cmatch SJC' | select UcsCentral, Dn, Name

Get all Roles that have the fault privilege.


Get-UcsCentralRole -Filter 'Priv -ccontains fault' | select UcsCentral, Dn, Name

Get all Roles that have the fault or operations privilege.


Get-UcsCentralRole -Filter 'Priv -canybit fault,operations’ | select UcsCentral, Dn, Name

Get all Roles that have the fault and operations privilege.


Get-UcsCentralRole -Filter 'Priv -callbits fault,operations' | select UcsCentral, Dn, Name

Get a list of faults generated between 4/18/2012 9:00 and 4/19/2012 9:30.


Get-UcsCentralFault -Filter 'Created -cbw "4/18/2012 9:00","4/19/2012 9:30"' | select UcsCentral, Cause, Dn, Created

Get Local Service Profiles with Name equals 'SJC'.


Get-UcsCentralComputeRequirement -Filter 'Name -ceq SJC' | select UcsCentral, Dn, Name

Get all Local Service Profiles with Name equals 'SJC/sjc/SjC', and so on


Get-UcsCentralComputeRequirement -Filter 'Name -ieq sjc' | select UcsCentral, Dn, Name

Get all Local Service Profiles with Name beginning with string 'SJC/sjc/SjC', and so on


Get-UcsCentralComputeRequirement -Filter 'Name -ilike SJC*' | select UcsCentral, Dn, Name

Get all Local Service Profiles with Name except 'SJC/sjc/SjC', and so on


Get-UcsCentralComputeRequirement -Filter 'Name -ine SJC' | select UcsCentral, Dn, Name

Generic Managed Object Queries

Get Managed Object of a specific DN.


Get-UcsCentralManagedObject -Dn "compute/sys-1010/chassis-2

Get all Managed Objects of a particular class.


Get-UcsCentralManagedObject -ClassId faultInst

Get DNs of Managed Objects of a particular class.


Get-UcsCentralManagedObject -ClassId faultInst –DnList

Get names of all Service Profiles from org-root.


Get-UcsCentralOrg -Level root | Get-UcsCentralManagedObject -ClassId computeRequirement | select Name

Get immediate children of org-root.


Get-UcsCentralOrg –Level root | Get-UcsCentralChild

Get parent of a Managed Object.


Get-UcsCentralOrg –Name Finance | Get-UcsCentralParent

Generic Managed Object Cmdlets

Create an Org


Add-UcsCentralManagedObject -ClassId orgOrg -PropertyMap @{Dn = "org-root/org-Finance"; Name = "Finance"}

Modify description of Managed Object.


Get-UcsCentralManagedObject -Dn org-root/org-Finance | Set-UcsCentralManagedObject -PropertyMap @{Descr = "Example generic set cmdlet";}

Remove a Managed Object.


Get-UcsCentralOrg –Name Finance | Remove-UcsCentralManagedObject

Export to XML

Export the configuration of a Managed Object.


Export-UcsCentralXml -Dn org-root/org-Finance -Hierarchy -LiteralPath C:\cmd.xml

Export the XML of a Managed Object into a file.


Get-UcsCentralServiceProfile -Name sp_name | Export-UcsCentralMoXml | Out-File c:\mo.xml

Import from XML

Import the configuration from the XML file.


Import-UcsCentralXml -LiteralPath C:\cmd.xml

Import XML of a Managed Object and convert it into objects.


Import-UcsCentralMoXml -LiteralPath c:\mo.xml

KVM

Start a KVM session for service profile.


Get-UcsCentralComputeRequirement -Name sp_name | Start-UcsCentralKvmSession

Start a KVM session for blade 2.


Get-UcsCentralChassis -Id 2 | Get-UcsCentralBlade -SlotId 2 | Start-UcsCentralKvmSession

Start a KVM session for RackUnit 1 with custom frame Title.


Get-UcsCentralRackUnit -Id 1 | Start-UcsCentralKvmSession -FrameTitle "KVM session window for RackUnit"

Registered UCS Domains

Get a list of Registered UCS Domains


Get-UcsCentralUcsDomain

Cmdlet Meta Information

Get Meta information about all Managed Object mapped cmdlets.


Get-UcsCentralCmdletMeta

Get Meta information about ComputeRequirement mapped cmdlets.


Get-UcsCentralCmdletMeta -ClassId computeRequirement

View the hierarchy of the ComputeRequirement class.


Get-UcsCentralCmdletMeta -Noun UcsCentralComputeRequirement -Tree

Get Meta information for the ComputeRequirement noun.


Get-UcsCentralCmdletMeta -Noun UcsCentralComputeRequirement
Get-UcsCentralCmdletMeta -Noun ComputeRequirement

See the Managed Object information for ComputeRequirement.


Get-UcsCentralCmdletMeta -ClassId computeRequirement | Select -ExpandProperty MoMeta

See the Managed Object property information for ComputeRequirement.


Get-UcsCentralCmdletMeta -ClassId computeRequirement | Select -ExpandProperty MoMeta | Select -ExpandProperty PropertyMeta

Add Cmdlet -ModifyPresent Flag

The ModifyPresent option ensures that the add-cmdlets modify the MO, if it exists, instead of returning an error.

Compare UCS Central Managed Object

The Compare-UcsCentralManagedObject cmdlet compares the managed objects from same or different UcsCentral domains and provides the ManagedObject Difference object generated by the cmdlet.


Note

You can execute the cmdlet, without a connection handle.



$refObj = Get-UcsCentralServiceProfile -Name TestSP -UcsCentral Ucsc-Bidwell-Dev-131a
$diffObj= Get-UcsCentralServiceProfile -Name TestSP -UcsCentral UcsCentral-Dev-Auburn
$compareObj = Compare-UcsCentralManagedObject -ReferenceObject $refObj -DifferenceObject $diffObj

Synchronize UCS Central Managed Object

The Sync-UcsCentralManagedObject cmdlet uses the ManagedObject Difference object to synchronize the managed objects on a same or different UcsCentral and make the configuration same throughout UcsCentral.


Sync-UcsCentralManagedObject -Difference $compareObj -UcsCentral UcsCentral-Dev-Auburn -Force

Launch UCS Central Domain Session

The Start-UcsCentralDomainSession cmdlet launches the UCS Manager GUI sessions registered with UcsCentral. You can provide a specific IP address of the UCS Manager to launch a particular UCS Manager GUI session.


Start-UcsCentralDomainSession [-Ip <string>] [-UcsCentral <UcsCentralHandle[]>] [<CommonParameters>]

Get UCS Central Server

The Get-UcsCentralServer cmdlet returns all the servers regardless of the form factor.


Get-UcsCentralServer [-UcsCentral <UcsCentralHandle[]>] [-Xml] [<CommonParameters>]

Obtaining Documentation and Submitting a Service Request

For information on obtaining documentation, submitting a service request, and gathering additional information, see What’s New in Cisco Product Documentation at:http://www.cisco.com/c/en/us/td/docs/general/whatsnew/whatsnew.html

Subscribe to What’s New in Cisco Product Documentation, which lists all new and revised Cisco technical documentation, as an RSS feed and deliver content directly to your desktop using a reader application. The RSS feeds are a free service.

Cisco and the Cisco logo are trademarks or registered trademarks of Cisco and/or its affiliates in the U.S. and other countries. To view a list of Cisco trademarks, go to this URL: www.cisco.com/go/trademarks. Third-party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1110R)

Any Internet Protocol (IP) addresses used in this document are not intended to be actual addresses. Any examples, command display output, and figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses in illustrative content is unintentional and coincidental.