Microsoft Virtualization Discussions

Is there a way to get the currently connected controller ?

raol

I am creating a script to create volumes... The input list consists of Filer name/volume name/aggregate name/size/etc in a csv format.... This list could span multiple controllers and plan on sorting the entries by Filer name...

In my volume creation loop I will take a line from the CSV input file and process it...

I don't want to do Connect-NAController for each entry... what I would like to do is skip the connection part if the Filer name is the same as the currently connected Filer...

Is there a way to find out what the currently connected filer is ?

Thanks

Mayur

1 ACCEPTED SOLUTION

raol

Looks like I may have found the answer to my question...

There is a variable $CurrentNAController.... and I can compare my Filer name to $CurrentNAController.Name

Going to try it out and see how I fare...

Thx

View solution in original post

3 REPLIES 3

raol

Looks like I may have found the answer to my question...

There is a variable $CurrentNAController.... and I can compare my Filer name to $CurrentNAController.Name

Going to try it out and see how I fare...

Thx

View solution in original post

vinith

Are you looking for something like this 

$controllerdetails = Get-Content "c:\vinith\desktop\controllerdetails.csv"

foreach ($control in $controllerdetails)

{

if (($global:CurrentNaController).name -match $control.filername)

  {

New-NaVol -Name $control.volumename ....(continued syntax)...

  }

else

{

Connect-NaController $control.filername ...(continued syntax)......

New-NaVol -Name $control.volumename ..(continued syntax).....

}

}

raol

Thank you Vinith...

Yes, that is what I was looking for... I actually made my code simpler and more compact rather than duplicate the volume creation code.... below is what I used...

 

If ($CurrentNAController.Name -ne $Filer) { Connect-NaController $Filer -Credential $Cred }

New-NaVol.......

Mayur

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public