Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 🙂
Solved! See The Solution
1 ACCEPTED SOLUTION
GabbaLo has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
get-naaggr
}
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
3 REPLIES 3
GabbaLo has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
get-naaggr
}
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you 🙂
With your code and a little fixing in my menu I was able to solve this problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
