ONTAP Discussions

Using Powershell to export all qtrees from a source-svm and importing it on a dest-svm

Thomas_
2,244 Views

Hi there,

 

we use a script to export and import export-policies including their client-matchlist from source to destination svms (http://scottharney.com/powershell-scripts-for-backup-of-cdot-nfs-exports/) which works fine, but we need a bit more...

 

We noticed on our destination svms that the only thing different than on our source svms is the qtree to export-policy association. Basically using the script above the export policy which is default for the volume gets inherited to all the qtrees. But on the source svm we have dedicated policies per qtree.

 

Anybody good with Powershell?

get-ncqtree delivers the qtrees

get-ncexportpolicy delivers the policies but shows multiple ones for the same volume instead of listing the qtrees...

 

 

Thanks for your help!

1 REPLY 1

TMACMD
2,222 Views

For what it's worth, the data is there. I am NOT a PowerShell guy, but playing around, I found this:

 

Connect-NcController -Name 192.168.0.101 -Credential (Get-Credential)

 

When I use the "Get-NcQtree", you are correct, it does not DISPLAY the ExportPolicy. However, if I do this:

 

$a = Get-NcQtree

$a.ExportPolicy

 

This outputs all the defined Export Policies.

Example:

PS C:\Users\Administrator.DEMO> Get-NcQtree

Volume Qtree Status SecurityStyle Oplocks Vserver
------ ----- ------ ------------- ------- -------
myluns normal unix enabled svm0
svm0_root normal unix enabled svm0
vol1 t1 normal unix enabled svm0
vol1 normal unix enabled svm0
svm1_root normal unix enabled svm1
vol2 normal unix enabled svm1

PS C:\Users\Administrator.DEMO> $a = Get-NcQtree
PS C:\Users\Administrator.DEMO> $a.ExportPolicy
default
default
me
vol1
default
vol2
PS C:\Users\Administrator.DEMO>

 (notice the "me" in the last output. That is a modified export-policy on the qtree "t1". The hosting volume "vol1" continues to have the "default" export-policy

 

I hope this helps you to figure out what you need. 

Public