cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1181
Views
4
Helpful
2
Replies

Connect-UCS with the help of the XML file

Hello all experts,

I am trying to connect to a UCS manager using the credentials saved in a XML file. Here is how I am doing it :-

1. Connect-Ucs -Name <Name>

2. Export-UcsPSSession -LiteralPath c:\test.xml ( Specified the key as "ucssession" when it prompts so )

3. Disconnect-ucs

4. connect-ucs -LiteralPath C:\test.xml -Key ucssession

I get the following errro message

Connect-Ucs : Cannot bind parameter 'Key'. Cannot convert the "ucssession"

value of type "System.String" to type "System.Security.SecureString".

At line:1 char:43

+ connect-ucs -LiteralPath C:\test.xml -Key ucssession

+                                           ~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (:) [Connect-Ucs], ParameterBin

   dingException

    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Cisco.Ucsm.Cmdlet

   s.ConnectUcs

Any idea how I can get past this? Basically I am looking for a way to schedule my scripts which will pull report from ucs and I dont want to specify username and password for connection in my scripts. Please advice.

1 Accepted Solution

Accepted Solutions

nveda
Level 1
Level 1

Hi Devender,

Small change in your script.

Cmdlet is expecting System.Security.SecureString and you are passing System.String.

Please try below –

1. Connect-Ucs -Name

2. Export-UcsPSSession -LiteralPath c:\test.xml ( Specified the key as "ucssession" when it prompts so )

3. Disconnect-ucs

4. $key = "ucssession" | ConvertTo-SecureString -AsPlainText -Force

5. connect-ucs -LiteralPath C:\test.xml -Key $key

Thank you,

Nitin

View solution in original post

2 Replies 2

nveda
Level 1
Level 1

Hi Devender,

Small change in your script.

Cmdlet is expecting System.Security.SecureString and you are passing System.String.

Please try below –

1. Connect-Ucs -Name

2. Export-UcsPSSession -LiteralPath c:\test.xml ( Specified the key as "ucssession" when it prompts so )

3. Disconnect-ucs

4. $key = "ucssession" | ConvertTo-SecureString -AsPlainText -Force

5. connect-ucs -LiteralPath C:\test.xml -Key $key

Thank you,

Nitin

Thanks. That worked.

Review Cisco Networking for a $25 gift card

Review Cisco Networking for a $25 gift card