Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
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
Solved! See The Solution
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
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
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).....
}
}
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