NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

Microsoft Virtualization Discussions

Credentials issue

david_ovenden
6,189 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
6,189 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
6,189 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
6,189 Views

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

Public