04-26-2016 02:55 AM
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.
Solved! Go to Solution.
04-26-2016 03:22 AM
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
04-26-2016 03:22 AM
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
04-27-2016 09:34 PM
Thanks. That worked.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide