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:
Problem
A connection exception error occurs when invoking a PowerShell API.
Description
When invoking a PowerShell API, the following message appears:
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> Invoke -userAPIGetAllCatalogs INFO: I/O exception <java.net.ConnectException> caught when processing request: Connection Refused: connect INFO: Retrying Request Invoke -userAPIGetAllCatalogs : Connection Refused: connect + Invoke -userAPIGetAllCatalogs + CategoryInfo : InvalidResult: <Couldn't get the Catalogs:String> [Invoke -userAPIGetAllCatalogs], ConnectException + FullyQualifiedErrorId : Couldn't get the Catalogs,CiscoUcsdPS.userAPIGetAllCatalogsCmdlet PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS>
Solution
Before invoking any PowerShell API, make sure that all the Cisco UCS Director services are running. If a service is down, restart the service and invoke the PowerShell API again.
Problem
PowerShell console cannot be started.
Description
When starting Cisco UCS Director PowerShell Console, the following error message appears:
PS C:\Program Files (x86)\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS> C:\Windows\System32\windowspowershell\v1.0\powershell.exe -NoExit -File -\StartUcsdPS.ps1 Windows PowerShell Copyright <c> 2013 Microsoft Corporation. All rights reserved. File C:\Program Files <x86>\Cisco\Cisco UCS Director PowerShell Console\Modules\CiscoUcsdPS\StartUcsdPS.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Exeuction_Policies at http://go.microsoft.com/fwlink/?LinkID=135170. + CategoryInfo : SecurityError: <:> [], ParentContainsErrorRecord Exception + FullyQualifiedErrorId : UnauthorizedAccess
Solution
The execution policy determines whether you can load configuration files (including your PowerShell profile) and run scripts. It also determines which scripts must be digitally signed before they are run. The Set-ExecutionPolicy cmdlet changes the user preference for the PowerShell execution policy.
To set the execution policy to By, start the Cisco UCS Director PowerShell Console and use the following command:
Set-ExecutionPolicy Unrestricted
Problem
During the execution of cmdlet, the PowerShell console throws one of the following errors:
The Cisco UCS Director server could not be reached.
The operation timed out error.
IP/REST Key can't be Empty.
Description
Even after configuring the environment variables UCSD_RESTKEY and UCSD_SERVER, the cmdlet has failed to execute.
PS C:\UCSDPowerShellTest\Modules\CiscoUcsdPS> [Environment]::SetEnvironmentVariable("UCSD_SERVER","10.1.1.1","User") PS C:\UCSDPowerShellTest\Modules\CiscoUcsdPS> [Environment]::SetEnvironmentVariable("UCSD_RESTKEY","5E8DA3924FDB4CC49213FCAAE2CBCEEB","User") PS C:\UCSDPowerShellTest\Modules\CiscoUcsdPS> Invoke-userAPIGetAllGroups Invoke-userAPIGetAllGroups : IP/REST Key can't be Empty At line:1 char:1 + Invoke-userAPIGetAllGroups + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (server/restKey:String) [Invoke - userAPIGetAllGroups], ArgumentException
Solution
Changes to environment variables take effect only after you close the PowerShell and open it again. Whenever you modify the environment variables, close the PowerShell console and open it again.