Command update - Set Qtree Options (for 1.0.2)

by Frequent Contributor on ‎2012-02-05 07:02 AM

Hello all,

Due to popular request, we have updated our "Set Qtree Options" command to allow setting opportunity locks and security settings on the volume itself.

Usage:

Just define a Qtree object in define node on the volume in question, with the applicable sec options and locks. For qtree name use "-", as per the picture below:

==============================================

Command code (For users of older versions and for reference):

param (

  [parameter(Mandatory=$true, HelpMessage="Array name or IP address")]

  [string]$Array,

  [parameter(Mandatory=$true, HelpMessage="Volume name")]

  [string]$VolumeName,

  [parameter(Mandatory=$true, HelpMessage="Qtree name")]

  [string]$QtreeName,

  [parameter(Mandatory=$false, HelpMessage="Virtual Filer name")]

  [string]$VFilerName,

  [parameter(Mandatory=$false, HelpMessage="The new oplocks settings.  Values are enabled or disabled")]

  [ValidateSet("enabled", "disabled")]

  [string]$OpLocks,

  [parameter(Mandatory=$false, HelpMessage="The new security style.  Values are unix, ntfs or mixed")]

  [ValidateSet("unix", "ntfs","mixed")]

  [string]$SecurityStyle

)

# connect to controller

Connect-WFAController -Array $Array -VFiler $VFilerName

if ($QtreeName -eq "-")

{

    $QtreeName = ""

}

# Check that Qtree exists

$QtreeStatus = Get-NaQtree -Volumename $VolumeName -QtreeName $QtreeName

if (-Not $QtreeStatus)

{

    $msg =  "QTree " + $QtreeName + " not found"

    throw $msg

}

# Path of an existing qtree. The path should be in this format: /vol/volume/qtree or /vol/volume/ to select the volume qtree.

$QtreePath = "/vol/" + $VolumeName + "/" + $QtreeName

Get-WFALogger -Info -message $("Working on qtree: " +$QtreePath)

if ($OpLocks)

{

    Get-WFALogger -Info -message $("Setting Qtree Oplocks: " +$OpLocks)

    Set-NaQtree -path $QtreePath -OpLocks $OpLocks

}

if ($SecurityStyle)

{

    Get-WFALogger -Info -message $("Setting Qtree Security style: " +$SecurityStyle)

    Set-NaQtree -path $QtreePath -SecurityStyle $SecurityStyle

}

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.