Microsoft Virtualization Discussions

Credentials issue

david_ovenden
5,036 Views

Hi All,

I am having trouble in scripts using the -controller switch on commands.  I keep getting an incorrect credentials message.

I have added the credentials (Add-NcCredential) and using the Connect-NcController command works fine and I get connected to the cluster or SVM.  I was expecting these saved credentials to be used when I run a command and add the -controller switch, as it is not working I assume that is not the case?

Is there a different way to save credentials for this switch to work?

I can work around the problem by keep changing the cluster of SVM I am connected to, but that makes the scripts inefficient and clumsy, especially when creating a loop that needs to check information on a source and a destination system.

3 REPLIES 3

billyd
5,036 Views

Here's what I use to cycle through several controllers in a script.  The takeaway is to have a variable that actually connects to the controller be used for the -controller switch.

$cred = get-credential admin01  # Retrieves the credentials for a user

foreach ($controller in get-content C:\list_of_controllers.txt){

     $login = connect-nccontroller $controller -credential $cred

     get-ncvol -controller $login

}

JGPSHNTAP
5,036 Views

Billy -

Just a quick comment.. You are doing this - $login = connect-nccontroller $controller -credential $cred, so you don't need to do this -controller $login

you should be able to just type get-ncvol

you have already established a connected to the controller with your $login credentials.


billyd
5,036 Views

Thanks for the help - I tried it out and it did supress the actual login to the controller.

Public