Subscribe
Accepted Solution

Powershell API creating qtree with null names

Hi,

Not sure if here is the right place to post but I am trying to create a Powershell script that will provision volumes/qtrees for us. I have it working thus far. The only issue I see is that it creates an no name qtree in every volume. THe logic of the script is this:

  1. Create volumes from txt file
  2. For each volume it creates it creates 9 qtrees
  3. Then I share qtree and set permissions

So instead of getting 9 qtrees I get 10. But the ones that are created with names follow the logic in the script (for eg qtree1....9 gets created as desired) But if you do a Get-NaQtree you see this

 

attach1                                                       normal          ntfs       enabled
attach1                        qtree1                         normal          ntfs       enabled
attach1                        qtree2                         normal          ntfs       enabled
attach1                        qtree3                         normal          ntfs       enabled
attach1                        qtree4                         normal          ntfs       enabled
attach1                        qtree5                         normal          ntfs       enabled
attach1                        qtree6                         normal          ntfs       enabled
attach1                        qtree7                         normal          ntfs       enabled
attach1                        qtree8                         normal          ntfs       enabled
attach1                        qtree9                         normal          ntfs       enabled

 

The funny thing is that you don't see the 'no name qtree' in OnCommand Sys Manager but you do see it in cli and SSH session.

 

My script is below.

 

 

$Volumes = (Get-Content -Path c:\Scripts\derivativesvol.txt)

$i = 1
foreach ($vol in $Volumes)
{
New-NaVol -Aggregate $Aggr -Name $vol -Size 50mb
Set-NaVolOption $vol no_atime_update on
$qcount = 1
Do
{
New-NaQtree -Path /vol/$vol/qtree$i -Verbose
Add-NaCifsShare -Name qtree$i -Path /vol/$vol/qtree$i -VirusScanRead $false
Remove-NaCifsShareAcl -Share qtree$i everyone
Get-NaCifsShareAcl base_share|Set-NaCifsShareAcl qtree$i
$i++
$qcount++
} While ($qcount -le 9)
}

 

Also, if you try to delete it says "Failed to delete qtree /vol/attach1/. Error: qtree is not a qtree in vol attach1

 

Any assistance is greatly appreciated!

Re: Powershell API creating qtree with null names

Oalexis -

 

Your script is working correctly.

It's not creating a null qtree - volumes are considered qtrees in many instances.

 

If you'd listed qtrees before creating any you would have seen 'attach1' listed as a qtree.


I hope this response has been helpful to you.

At your service,

Eugene E. Kashpureff, Sr.
Independent NetApp Consultant http://www.linkedin.com/in/eugenekashpureff
Senior NetApp Instructor, IT Learning Solutions http://sg.itls.asia/netapp
(P.S. I appreciate 'kudos' on any helpful posts.)

Re: Powershell API creating qtree with null names

Ok Thank you!!

Re: Powershell API creating qtree with null names

 

Oalexis -

 

You're very welcome.

 

Always happy when I can be of help !


At your service,

Eugene E. Kashpureff, Sr.
Independent NetApp Consultant http://www.linkedin.com/in/eugenekashpureff
Senior NetApp Instructor, IT Learning Solutions http://sg.itls.asia/netapp
(P.S. I appreciate 'kudos' on any helpful posts.)