The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
This chapter contains the following sections:
You can view the list of available cmdlets by using Get-Command.
The following list of cmdlets was obtained by using the Get-Command:
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> Get-Command -Module CiscoUcsdPS CommandType Name ModuleName ---------- ---- ---------- Cmdlet Invoke-UserAPICancelServiceRequest CiscoUcsdPS Cmdlet Invoke-UserAPIExecuteVMAction CiscoUcsdPS Cmdlet Invoke-UserAPIGetAllCatalogs CiscoUcsdPS Cmdlet Invoke-UserAPIGetAllGroups CiscoUcsdPS Cmdlet Invoke-userAPIGetAllVDCs CiscoUcsdPS Cmdlet Invoke-UserAPIGetAvailableReports CiscoUcsdPS Cmdlet Invoke-UserAPIGetHistoricalReport CiscoUcsdPS Cmdlet Invoke-UserAPIGetInstantDataReport CiscoUcsdPS Cmdlet Invoke-UserAPIGetPage CiscoUcsdPS Cmdlet Invoke-UserAPIGetServiceRequestDetails CiscoUcsdPS Cmdlet Invoke-UserAPIGetServiceRequests CiscoUcsdPS Cmdlet Invoke-UserAPIGetServiceRequestWorkflow CiscoUcsdPS Cmdlet Invoke-UserAPIGetTabularReport CiscoUcsdPS Cmdlet Invoke-UserAPIGetVMActionRequests CiscoUcsdPS Cmdlet Invoke-UserAPIGetWorkflowInputs CiscoUcsdPS Cmdlet Invoke-UserAPIGetWorkflowInputValue CiscoUcsdPS Cmdlet Invoke-UserAPIGetWorkflowInputValues CiscoUcsdPS Cmdlet Invoke-UserAPIGetWorkflows CiscoUcsdPS Cmdlet Invoke-UserAPIGetWorkflowStatus CiscoUcsdPS Cmdlet Invoke-UserAPIReconfigureVM CiscoUcsdPS Cmdlet Invoke-UserAPIRollbackflow CiscoUcsdPS Cmdlet Invoke-UserAPISubmitServiceRequest CiscoUcsdPS Cmdlet Invoke-UserAPISubmitServiceRequestCustom CiscoUcsdPS Cmdlet Invoke-UserAPISubmitWorkflowServiceRequest CiscoUcsdPS Cmdlet Invoke-UserAPISubmitWorkflowServiceRequestWithG... CiscoUcsdPS Cmdlet Invoke-UserAPISubmitWorkflowServiceRequestWithS... CiscoUcsdPS Cmdlet Invoke-UserAPIValidateWorkflow CiscoUcsdPS Cmdlet Invoke-UserAPIWorkflowInputDetails CiscoUcsdPS PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS>
You can run cmdlets in Cisco UCS Director PowerShell Console. To get help for a cmdlet, use the ? or get-Help command.
When you enter ? with the cmdlet, you see the syntax, parameters, aliases, and remarks for the cmdlet.
This example shows how to get help for a cmdlet:
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> Invoke–userAPISubmitServiceRequest –? NAME Invoke–userAPISubmitServiceRequest SYNTAX Invoke–userAPISubmitServiceRequest [–catalogName] <string> [-vdcName] <string> [-durationHours] <int> [-beginTime] <long> [- quantity] <int> [-comments] <string> [-server <string>] [-restkey <string>] ALIASES None REMARKS None PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS>
Each cmdlet has mandatory and optional parameters. For example, the Invoke–userAPISubmitServiceRequest cmdlet has catalogName as a mandatory parameter, while server and restKey are optional parameters.
You can get detailed help about an individual parameter of a cmdlet when you use the get-Help command, the cmdlet name, and the parameter:
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> get-Help Invoke–userAPISubmitServiceRequest –Parameter catalogName –catalogName <string> Required? true Position? 0 Accept pipeline input? false Paramter set name <All> Aliases None Dynamic? None PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> get-Help Invoke–userAPISubmitServiceRequest –Parameter server –server <string> Required? false Position? Named Accept pipeline input? false Paramter set name <All> Aliases None Dynamic? false PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS>
The cmdlets that submit a workflow take an array of name-value pairs as workflow inputs. You must specify the input as an array of colon-separated name-value pairs:
Name1:value1, Name2:value2
For example, to submit a workflow named user-add-test, specify the input in the following way:
Invoke-userAPISubmitWorkflowServiceRequest user-add-test -parameters user-type:Regular,group-id:1,login-name:cmdlettest1,password:test,confirm-password:test,email:user@mail.com
You can connect commands with the pipe operator (¦), to execute common options on the command output. The output of each command is used as input for the next command.
The following table lists the types of objects that are written to the pipeline by cmdlets.
Cmdlet | Return Object Type |
---|---|
Invoke-userAPICancelServiceRequest | Boolean |
Invoke-userAPIExecuteVMAction | String |
Invoke-userAPIGetAllCatalogs | APITabularReport |
Invoke-userAPIGetAllGroups | APITabularReport |
Invoke-userAPIGetAllVDCs | APITabularReport |
Invoke-userAPIGetAvailableReports | Array of APIReportDefinition |
Invoke-userAPIGetHistoricalReport | Array of HistoricalDataSeries |
Invoke-userAPIGetInstantDataReport | APISnapshotReport |
Invoke-userAPIGetPage | VMDataViewPaginated |
Invoke-userAPIGetServiceRequestDetails | APIServiceRequestDetails |
Invoke-userAPIGetServiceRequests | APITabularReport |
Invoke-userAPIGetServiceRequestWorkFlow | APIWorkflowStatus |
Invoke-userAPIGetTabularReport | APITabularReport |
Invoke-userAPIGetVMActionRequests | APITabularReport |
Invoke-userAPIGetWorkflowInputs | Array of APIWorkflowInputDetail |
Invoke-userAPIGetWorkflowInputValue | String |
Invoke-userAPIGetWorkflowInputValues | WorkflowInputValue |
Invoke-userAPIGetWorkflows | Array of CustomActionDefinition |
Invoke-userAPIGetWorkflowStatus | Integer |
Invoke-userAPIReconfigureVM | String |
Invoke-userAPIRollbackWorkflow | SR ID |
Invoke-userAPISubmitServiceRequest | SR ID |
Invoke-userAPISubmitServiceRequestCustom | SR ID |
Invoke-userAPISubmitWorkflowServiceRequest | SR ID |
Invoke-userAPISubmitWorkflowServiceRequestWithGroup | SR ID |
Invoke-userAPISubmitWorkflowServiceRequestWithStartTime
AndDurationHours |
SR ID |
Invoke-userAPIValidateWorkFlow | APIWFValidationResult |
Invoke-userAPIWorkflowInputDetails | APIWorkflowInputDetails |
Invoke-UserAPIGetAllCatalogs
Invoke-UserAPIGetAllGroups
Invoke-UserAPIGetAvailableReports
Invoke-UserAPIGetHistoricalReports
Invoke-UserAPIGetInstantDataReport
Invoke-UserAPIGetPage
Invoke-UserAPIGetSeviceRequestDetails
Invoke-UserAPIGetSeviceRequests
Invoke-UserAPIGetSeviceRequestWorkflow
Invoke-UserAPIGetTabularReport
Invoke-UserAPIGetVMActionRequests
Invoke-UserAPIGetWorkflowInputs
Invoke-UserAPIGetWorkflowInputValue
Invoke-UserAPIGetWorkflowInputValues
Invoke-UserAPIGetWorkflows
Invoke-UserAPIGetWorkflowStatus
Invoke-UserAPIGetallVDCs
The userAPIGetPage API requires the name of the paginated report as one of the parameters.
The following table provides the report name and its context value:
Report Name | Context Value |
---|---|
CHARGEBACK_DETAILS_SERVICES_GLOBAL_TABULAR | None |
PER_CLOUD_ARCHIVED_HYPERV_VM_LIST_REPORT | <cloudName> |
vms.paginated.report | <cloudName> |
PER_CLOUD_ARCHIVED_VM_LIST_REPORT | <cloudName> |
For example, specify the following input to fetch a page of the vmware-account account report:
Invoke-userAPIGetPage vms.paginated.report vmware-account 1 10
Cmdlets are executed in the same way as any other PowerShell command. You can apply common operations, such as search and filtering, to the outputs of the commands by using the pipe operator (¦). The following examples illustrate how to execute cmdlets.
Cmdlets are executed in the same way as any other PowerShell command. You can apply common operations, such as search and filtering, to the outputs of the commands by using the pipe operator (¦).
The following example shows how to obtain the parameters of a cmdlet using the ? command.
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> Invoke–userAPIGetWorkflowInputValues –? NAME Invoke–userAPIGetWorkflowInputValues SYNTAX Invoke–userAPIGetWorkflowInputValues [–srId] <int> [-server <string>] [-restkey <string>] [<CommonParameters>] ALIASES None REMARKS None PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS>
When you know the syntax of a cmdlet, you can capture the cmdlet output as shown below:
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> Invoke–userAPIGetWorkflowInputValues 429 Input Set Id Action Id Field Id Field Value ------------ --------- -------- ----------- 18 0 WF_EMPTY_INPUTS 18 156 input_0_user-type471 Regular 18 156 AddUser_231.OUTUT_USER_NAME cmdlettest1 18 156 input_3_password453 test 18 156 input_4_confirm-password361 test 18 156 input_5_email1932 user@mail.com 18 156 input_1_group-id135 1 18 156 input_2_login-name867 cmdlettest1 PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS>
You can further filter the output as shown below:
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> Invoke–userAPIGetWorkflowInputValues 429 ¦ Select-Object 'Field Id', 'Field Value' Field Id Field Value -------- ----------- WF_EMPTY_INPUTS input_0_user-type471 Regular AddUser_231.OUTUT_USER_NAME cmdlettest1 input_3_password453 test input_4_confirm-password361 test input_5_email1932 user@mail.com input_1_group-id135 1 input_2_login-name867 cmdlettest1 PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS>
The following example displays the object value for the Invoke-userAPIGetAllGroups API.
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> Invoke-userAPIGetAllGroups com.cisco.cuic.api.client.APITabularReport@307e168 PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS>
Adding "-verbose" to the same syntax displays the list of groups in the form of a tabular report.
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> Invoke-userAPIGetAllGroups -verbose VERBOSE: Connected to the UCSD at 172.22.234.237, Getting the List of Groups... VERBOSE: List of Groups returned by the UCSD. GROUP_ID GROUP_NAME GROUP_CODE GROUP_DESCRIPTION SOURCE COST_CENTER GROUP_CONTACT_NAME GROUP_CONTACT_EMAIL_ADDRESS BUDGET_REQUIRED RESOURCE_LIMITS_SET LDAP_ACCOUNT HOST TAGS GROUP_SHARE_POLICY ALLOWS_RESOURCES_TO_USER TAG 1 Default Group DEF Default Group. All discovered VMs are placed in this group. Local System Administrator No No No PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS>
Note | For all APIs that return tabular reports, add "-verbose" to the syntax to view tabular reports. When you do not add "-verbose", only the object type and its address are returned. |
This section explains how you can cancel a service request through the PowerShell Console.
Ensure that you have configured the environment variables in the PowerShell Console to run the cmdlets against the Cisco UCS Director server. For more information, see Cisco UCS Director PowerShell Console Configuration.
Step 1 | View the list of cmdlets that are available for use by using Get-Command. The cmdlet for canceling a service request is Invoke–userAPICancelServiceRequest. | ||
Step 2 | Get the
parameters of the
Invoke–userAPICancelServiceRequest cmdlet using the
? command.
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> Invoke–userAPICancelServiceRequest –? NAME Invoke–userAPICancelServiceRequest SYNTAX Invoke–userAPICancelServiceRequest [–requestId] <int> [-server <string>] [-restkey <string>] [<CommonParameters>] ALIASES None REMARKS None PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS>
| ||
Step 3 | Execute the
command by passing the service request ID (79 in this example) as follows:
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> Invoke–userAPICancelServiceRequest 79 True PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> |