Hi Tas,
I don't really understand your problem 😉 can you give an example snippet of your script?
I don't see what you mean by "preauthenticate".
Are you using the Connect-NcController cmdlet to connect to each controller, or not?
For me this works:
# Ask for credentials
$credA = Get-Credential -Message "Enter password for clusterA" -UserName admin
$credB = Get-Credential -Message "Enter password for clusterB" -UserName admin
$credC = Get-Credential -Message "Enter password for clusterC" -UserName admin
# Authenticate and connect
$cluA = Connect-NcController -Credential $credA - Name clusterA
$cluB = Connect-NcController -Credential $credB -Name clusterB
$cluC = Connect-NcController -Credential $credC -Name clusterC
Note that the "Connect-NcController" Cmdlet is important to authenticate and connect to each cluster.
It returns an object of type [NetApp.Ontapi.Filer.C.NcController], which (if successfull) is a "authenticated and connected" cluster. You can see the object properties now with e.g.
$cluA | get-member
^^ it has a couple of properties, including "Credentials" - so this object INCLUDES the connection details AND the credentials used for the connection.
So, in short, this objects stores an"authenticated connection to clusterA".
After that, no matter what other cmdlet you use, you can use the "-Controller" parameter to refer to a (previously CONNECTED) cluster, e.g.:
Get-NcAggr -Controller $cluA
Get-NcAggr -Controller $cluB
Get-NcAggr -Controller $cluC
Get-NcDiagnosisStatus -Contoller $cluA
Get-NcDiagnosisStatus -Contoller $cluB
Get-NcDiagnosisStatus -Contoller $cluC
At least, this is how it works for me. Hope this helps.
P.S.: instead of requesting the credentails from the user every time you run your script, you could also SAFELY STORE credentials in your local credential store like this:
Add-NcCredential -Name clusterA -Credential $credA
You can see your store contents with "Get-NcCredential".
Permanently storing credentials (they are encrypted and stored in in your user profile) makes life easier, because there is no need to pass a "-Credential" parameter anymore to the "Connect-NcController" cmdlet, e.g.
$cluA = Connect-NcController -Name clusterA
will NOT aks for credentials, because it finds a matching credential for "clusterA" in its local credential store.
However, without using "Connect-NcController", you'll probably have problems 😉
Hope this helps!