Microsoft Virtualization Discussions



Hi everybody,


I just wrote a script to get all the AGGR status of all filers.

Therefore I loop through all filers, open the connection and

$var = Connect-NaController $Controller

Get-NaAggr -Controller $var

(roughly 😉 )


All write-hosts in the script work, the loops goes fine and all potential errors are not triggered.

Anyway, only the AGGRs of the first given filer are printed in the console ... regardless of the $Controller written above (which is correct in every loop walkthrough)

So I wonder if there IS anything like Disconnect-NaController!?


I already found the solutions here ($global:CurrentNaController = $null) or here (use the -Transient switch to Connect-NaController), but neither of them worked for me.


Any other ideas?


Thank you 🙂


Re: Disconnect-NaController?


Ok, i'm not sure how many filers you are looping through but here's a suggestion


If you are using a csv or txt file import there are different ways to do it


Also, if you don't need credential and are using RPC it's easier as well


So for example


$filers = gc c:\filers.txt


$filers | % {

$filer = $_

$c = connect-nacontroller $filer




Obviously, there are other ways to do that..


If you want to append it to a csv, I would suggest outputing it to a csv with -append and building an expression statement with Select-object for your controller

So, something like this.

get-naaggr | Select @{n='filer';E={($global:currentnacontroller).name}},Name, State,Totalsize,Used,Available | epcsv -append c:\temp\filers.csv -notypeinformation



Now once you use that type of select object, you will have to build expression statements with convertto-formattednumber or math .net functions  


Give it a shot, if you get stuck we can help




View solution in original post

Re: Disconnect-NaController?


Thank you 🙂
With your code and a little fixing in my menu I was able to solve this problem.

Re: Disconnect-NaController?


To Disconnect NaController, you can find the parameter "-Timeout" in Connect-NaController. We can provide approximate seconds in the cmdlet Connect-NaController -Timeout 7000. So it will Disconnect by itslef.







Earn Rewards for Your Review!
GPI Review Banner
All Community Forums