So I found a work around. Originally I tried to connect using the below code where domain.local would be the name of my Authentication Domain inside the UCS :
1
2# UCS account
3$ucspass = cat "C:\temp\login.txt" | convertto-securestring
4$ucscred = new-object -typename System.Management.Automation.PSCredential -argumentlist "ucs.domain.local\kmurphy",$ucspass
5
6Connect-UCSM -Name "ucs.domain.local" -Credential $ucscred
This would always fail with an error:
Connect-UCSM : Authentication failed
At line:6 char:13
+ Connect-UCSM <<<< -Name "UCS.domain.local" -Credential $ucscred
+ CategoryInfo : ResourceUnavailable: (UCS connection Error:String)
[Connect-UCSM], Exception
+ FullyQualifiedErrorId : LoginError,Cisco.UCSCmdlet.Commands.Connection.Con
nectUCSMFor the past few days I have been mulling over the idea of using my old connection object with aaaLogin and passing the information into an object of the same type of CurrentUCSMInstance but didn't feel like it was a proper enough solution. Today I got struck and realized I should look deeper at the CurrentUCSMInstance and created a new object of Cisco.Common.DataTypes.UCSLoginInfo. I am happy to say that this code successfully returned an authenticated connection and queries for Get-Chassis.
1
2 # UCS account
3 $ucspass = cat "C:\temp\login.txt" | convertto-securestring
4 $ucscred = new-object -typename System.Management.Automation.PSCredential -argumentlist "ucs-domain.local\kmurphy",$ucspass
5
6 $CurrentUCSMInstance = New-Object Cisco.Common.DataTypes.UCSLoginInfo
7 $CurrentUCSMInstance.Name = "ucs.domain.local"
8 $CurrentUCSMInstance.ConnectionInstance = 'CurrentUCSMInstance'
9 $CurrentUCSMInstance.Credential = $ucscred
10 $CurrentUCSMInstance.UcsUri = "https://ucs.domain.local/nuova"
11$CurrentUCSMInstance.Connect()
12$chassis = Get-Chassis
13Disconnect-UCSM
You can see I am using the same creds file and username so nothing has changed accept for how the object was created and passed. Maybe some one from Cisco can explain what their Connect-UCSM cmdlet is doing that is being circumvented by using the Connect() method for the class Cisco.Common.DataTypes.UCSLoginInfo. At least this gives me a work around to allow my scripts to run but keep proper user auditing to see who did what in the audit log while they fix the Connection cmdlet.
Kevin Murphy