I am trying to create a script that will create numerous qtrees that have spaces in the qtree name. I am importing the qtree names from a CSV file and building an array with the full path of the qtree. Here is a overview of how I am building the qtree path:
If I write the command to the screen with the following command I can copy and paste the output and it runs just fine:
write-host "New-NaQtree" $Qtree
When I attempt to loop through the array and execute the qtree creations it fails because it "can't determine volume/qtree names" The quotes in the path seem to be messing with the ability to find the qtree path. I attempted to put the entire command into the array and use the invoke expression to run the command. Here is a sample of what I tried:
This seems to work but it drops the quotes so all of the qtree names that contain spaces are created incorrectly. Can someone please help me figure out how to get these qtrees created when using quotes??
Thank you for the reply. The issue is that we are moving from a legacy Celerra to the Netapp and all of the tree quotas on the Celerra were created with the spaces in the names. In order to not break everything we had to leave the spaces in place.
Re: New-NaQtree fails when passing quotes into the cmdlet
Thanks so much that works like a champ!! Now I am also having an issue with setting quotas on the qtree when there are space is the name.
I believe I can use the same invoke-NaSystemApi "<quota-add-entry> "?? But I am unsure on the rest of the syntax. My command would have been Add-naquota tree "/vol/office01/A B" -Threshold 100g. This of course is having the same issue as the earlier qtree create command.