<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Hopefully simple PowerShell question in Active IQ Unified Manager Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74928#M15586</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the thought of doing it in Perl crossed my mind as well, but as there are no examples of Perl commands, I'd have a lot more trial-and-error work in figuring out how variables are passed in and how to interface with WFA itself without the WFA PowerShell module (e.g. how to call the WFA logger, etc.). The second reason was that there's an existing Powershell command that does a lot of what I want to do, so I'd prefer to modify it rather than start from scratch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The working version looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get-NaSnapvaultPriDestinations | Where-Object{$_.SourcePath -match "/vol/$VolumeName/"} | ForEach-Object {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SecondaryVolume=$_.ChainedDestinations[0].DestinationPath.split("/")[2]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SecondaryArray=$_.ChainedDestinations[0].DestinationSystem&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jul 2012 06:36:26 GMT</pubDate>
    <dc:creator>jont</dc:creator>
    <dc:date>2012-07-12T06:36:26Z</dc:date>
    <item>
      <title>Hopefully simple PowerShell question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74888#M15571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi PowerShell Power Users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working on a new Resize Volume command which will act on all the SnapVault destinations of a volume, as well as the source volume itself. I'm new to PowerShell and am having some problems properly munging my output into a form that can be used by other commands. To wit:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;PS C:\DataONTAP PowerShell Toolkit 2.0&amp;gt; $VolumeName = "ngs01_nfs"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This command returns all the destinations I'm interested in resizing:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;PS C:\DataONTAP PowerShell Toolkit 2.0&amp;gt; $svDestinations = Get-NaSnapvaultPriDestinations | Where-Object{$_.SourcePath -match "/vol/$VolumeName/"} | Select-Object -Property ChainedDestinations&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;PS C:\DataONTAP PowerShell Toolkit 2.0&amp;gt; $svDestinations&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ChainedDestinations&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;-------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;{dedusngs02:/vol/ngs01_nfs_sv/qt1}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The variable returned looks like a string, but it's an object&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;PS C:\DataONTAP PowerShell Toolkit 2.0&amp;gt; $svDestinations.ChainedDestinations&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;DestinationPath&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DestinationSystem&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;---------------&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -----------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;/vol/ngs01_nfs_sv/qt1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dedusngs02&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;A Miracle Happens Here (this is where I could use the help!)&lt;/SPAN&gt; that extracts the following two variables&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;$DestSystem = dedusngs02&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;$DestVolumeName = ngs01_nfs_sv&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This is simple in Perl, so since PowerShell is awesome, this must be easy...&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and then I can solve my problem and run:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Connect-WFAController -Array $DestSystem&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Set-NaVolSize -Name $DestVolumeName -NewSize ($TargetSize + "m") -Controller $DestSystem&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any tips!&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2025 06:23:25 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74888#M15571</guid>
      <dc:creator>jont</dc:creator>
      <dc:date>2025-06-05T06:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully simple PowerShell question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74893#M15573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$svDestinations.ChainedDestinations[0].DestinationPath should give you the path (and similar for the system). If you have more than one destination that is returned (e.g. multiple qtrees in the same volume that are snapvaulted), you can access the first destination path at $svDestinations[0].ChainedDestinations[0]DestinationPath and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hendrik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jul 2012 22:11:51 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74893#M15573</guid>
      <dc:creator>hland</dc:creator>
      <dc:date>2012-07-04T22:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully simple PowerShell question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74902#M15577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hendrik and The Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that helps me get to the object I need to address, which was half the battle. The other half is acting on the object in a useful manner. I've poked around at the PowerShell blogs for an equivalent to a perl command such as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$svDestinations[0].ChainedDestinations[0]DestinationPath&lt;CODE&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=~&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; /\/vol\/([a-z0-9_]+)\//;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;$DestVolumeName = $1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to extract the volume name string out of the path name (since I need to hand the resize cmdlet a volume name, not a path name), but I haven't found any equivalent functions. Any ideas as to how to produce similar results in PowerShell?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2012 16:00:39 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74902#M15577</guid>
      <dc:creator>jont</dc:creator>
      <dc:date>2012-07-09T16:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully simple PowerShell question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74906#M15578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is a built in function called splitByDelimeter which can be used for this action.&amp;nbsp; Provide the string to split, the delimeter and then the index.&amp;nbsp; In this case the index would be 2. splitByDelimiter("/vol/test/me", "/", 2) = "test".&amp;nbsp; Just pass in your Destination Path.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jul 2012 16:14:40 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74906#M15578</guid>
      <dc:creator>goodrum</dc:creator>
      <dc:date>2012-07-09T16:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully simple PowerShell question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74911#M15580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This may be a silly question, but it seems like you're much more familiar with Perl, so why not create your commands in Perl instead of PowerShell?&amp;nbsp; Wouldn't that be easier for you?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 05:00:32 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74911#M15580</guid>
      <dc:creator>bdave</dc:creator>
      <dc:date>2012-07-12T05:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully simple PowerShell question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74914#M15582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think that will work for him, Jeremy, since he's looking to do this within the Command, not within the WFA framework itself.&amp;nbsp; It needs to be a PowerShell thing, not MVEL Java.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 05:07:47 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74914#M15582</guid>
      <dc:creator>bdave</dc:creator>
      <dc:date>2012-07-12T05:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully simple PowerShell question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74919#M15584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's the easy way (in PowerShell):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 12pt;"&gt;$DestVolumeName = $svDestinations[0].ChainedDestinations[0].DestinationPath&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier; font-size: 12pt;"&gt;$DestVolumeName = $DestVolumeName.Split("/")[2]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Dave&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 05:40:40 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74919#M15584</guid>
      <dc:creator>bdave</dc:creator>
      <dc:date>2012-07-12T05:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully simple PowerShell question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74928#M15586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the thought of doing it in Perl crossed my mind as well, but as there are no examples of Perl commands, I'd have a lot more trial-and-error work in figuring out how variables are passed in and how to interface with WFA itself without the WFA PowerShell module (e.g. how to call the WFA logger, etc.). The second reason was that there's an existing Powershell command that does a lot of what I want to do, so I'd prefer to modify it rather than start from scratch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The working version looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get-NaSnapvaultPriDestinations | Where-Object{$_.SourcePath -match "/vol/$VolumeName/"} | ForEach-Object {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SecondaryVolume=$_.ChainedDestinations[0].DestinationPath.split("/")[2]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SecondaryArray=$_.ChainedDestinations[0].DestinationSystem&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2012 06:36:26 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74928#M15586</guid>
      <dc:creator>jont</dc:creator>
      <dc:date>2012-07-12T06:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully simple PowerShell question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74934#M15587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just FYI, jont, I posted several Perl example commands and an example workflow that uses them to the WFA community site recently.&amp;nbsp; I used Perl to talk to DFM using just ZAPI calls.&amp;nbsp; No SSH required.&amp;nbsp; &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.netapp.com/5.0.1/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shortcut: &lt;A _jive_internal="true" href="https://community.netapp.com/docs/DOC-17802" target="_blank"&gt;https://communities.netapp.com/docs/DOC-17802&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Aug 2012 18:36:14 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74934#M15587</guid>
      <dc:creator>bdave</dc:creator>
      <dc:date>2012-08-01T18:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Hopefully simple PowerShell question</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74939#M15588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi bdave,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the pointer to your Perl example, I'll take a look! The Powershell command I was building (resizing a primary and all secondary destinations) is now in production testing. I'm appending the code if you're interested.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# ResizeSourceAndDestVolume Command Version 3.3&lt;/P&gt;&lt;P&gt;param (&lt;/P&gt;&lt;P&gt;&amp;nbsp; [parameter(Mandatory=$true, HelpMessage="Array name or IP address")]&lt;/P&gt;&lt;P&gt;&amp;nbsp; [string] $Array,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; [parameter(Mandatory=$true, HelpMessage="Name of primary volume to be modified")]&lt;/P&gt;&lt;P&gt;&amp;nbsp; [string]$VolumeName,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; [parameter(Mandatory=$true, HelpMessage="The max size of the volume while autosizing in MBytes")]&lt;/P&gt;&lt;P&gt;&amp;nbsp; [int]$TargetSize,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; [parameter(Mandatory=$true, HelpMessage="Maximum % full level of a volume after resize")]&lt;/P&gt;&lt;P&gt;&amp;nbsp; [int]$MaxFillPercentage&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# connect to controller&lt;/P&gt;&lt;P&gt;Connect-WFAController -Array $Array&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Check if volume exists&lt;/P&gt;&lt;P&gt;$volume = Get-NaVol -Names $VolumeName -ErrorAction Stop&lt;/P&gt;&lt;P&gt;if($volume.State -eq "restricted")&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw "Volume " + $VolumeName + " is in restricted state"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;elseif($volume.State -eq "offline")&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw "Volume " + $VolumeName + " is in offline state"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# If the size is 0GB and we've gotten this far, remap it to 20mb (minimum size for a volume). &lt;/P&gt;&lt;P&gt;# Someone apparently wants a minimally sized volume.&lt;/P&gt;&lt;P&gt;if($TargetSize -eq 0)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;$TargetSize = 20&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Enforce the policy that a volume may not be resized to be more than (usable space) MaxFillPercentage full. &lt;/P&gt;&lt;P&gt;$SnapReserve = Get-NaSnapshotReserve -Name $VolumeName&lt;/P&gt;&lt;P&gt;$FuturePercentFull=($volume.Used) * $TargetSize / (($volume.TotalSize + $SnapReserve.Size)/1024/1024)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;if($FuturePercentFull -gt $MaxFillPercentage)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw "Volume " + $VolumeName + " would be " + [string]$FuturePercentFull + "% full after resizing. Maximum permitted is " + [string]$MaxFillPercentage + "%"&lt;/P&gt;&lt;P&gt;} &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get-WFALogger -Info -message $("Resizing volume " + $VolumeName + " with value: "+ ([string]$TargetSize + "m"))&lt;/P&gt;&lt;P&gt;Set-NaVolSize -Name $VolumeName -NewSize ([string]$TargetSize + "m")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Find out if the volume being changed is a source volume for a replication relationship.&lt;/P&gt;&lt;P&gt;# If it is, try to resize the destination volume(s) as well. The destination will be&lt;/P&gt;&lt;P&gt;# resized to be MaxFillPercentage full after resizing (e.g if MaxFillPercentage is 85, the volume &lt;/P&gt;&lt;P&gt;# will be set to be whatever size would result in an 85% full level). If this is too small, the&lt;/P&gt;&lt;P&gt;# autogrow policies on the nearstores will extend the volume dynamically.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get-NaSnapvaultPriDestinations | Where-Object{$_.SourcePath -match "/vol/$VolumeName/"} | ForEach-Object {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SecondaryVolume=$_.ChainedDestinations[0].DestinationPath.split("/")[2]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SecondaryArray=$_.ChainedDestinations[0].DestinationSystem&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Connect-WFAController -Array $SecondaryArray&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $destVolume=Get-NaVol -Names $SecondaryVolume -ErrorAction Stop&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # The minimum size for a destinatino volume is 10 GB per policy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $NewSize=$destVolume.SizeUsed/($MaxFillPercentage/100)/1024/1024&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($NewSize -lt 10*1024*1024*1024)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $NewSize=10*1024*1024*1024&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $StringNewSize=[string]$NewSize + "m"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $message="Resizing SnapVault destination volume " + $SecondaryVolume + " with value: " + $StringNewSize&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get-WFALogger -Info -message $($message)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set-NaVolSize -Name $SecondaryVolume -NewSize $StringNewSize&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Connect-WFAController -Array $Array&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Valid for QSM only (need to separate QSM and VSM to avoid searching for "vol1" and resizing destinations of "vol1a"&lt;/P&gt;&lt;P&gt;Get-NaSnapmirrorDestination | Where-Object{$_.SourceLocation -match "/vol/$VolumeName/"} | ForEach-Object {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SecondaryVolume=$_.DestinationLocation.split("/")[2]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SecondaryArray=$_.DestinationLocation.split(":")[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Connect-WFAController -Array $SecondaryArray&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $destVolume=Get-NaVol -Names $SecondaryVolume -ErrorAction Stop&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $NewSize=$destVolume.SizeUsed/($MaxFillPercentage/100)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # The minimum size for a destinatino volume is 10 GB per policy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($NewSize -lt 10*1024*1024*1024)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $NewSize=10*1024*1024*1024&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $StringNewSize=[string]$NewSize + "m"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $message="Resizing Qtree SnapMirror destination volume " + $SecondaryVolume + " with value: " + $StringNewSize&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get-WFALogger -Info -message $($message)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set-NaVolSize -Name $SecondaryVolume -NewSize $StringNewSize&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Connect-WFAController -Array $Array&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Valid for VSM only&lt;/P&gt;&lt;P&gt;# Note: shrinking a destination will fail, as the file system in the destination will be resized only &lt;/P&gt;&lt;P&gt;# after a VSM update is completed. &lt;/P&gt;&lt;P&gt;# ***This resize is expected to fail in the unlikely event that a VSM destination is shrunk!***&lt;/P&gt;&lt;P&gt;Get-NaSnapmirrorDestination | Where-Object{$_.SourceLocation.split(":")[1] -eq $VolumeName} | ForEach-Object {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SecondaryVolume=$_.DestinationLocation.split(":")[1]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $SecondaryArray=$_.DestinationLocation.split(":")[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Connect-WFAController -Array $SecondaryArray&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $destVolume=Get-NaVol -Names $SecondaryVolume -ErrorAction Stop&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $NewSize=$destVolume.SizeUsed/($MaxFillPercentage/100)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # The minimum size for a destinatino volume is 10 GB per policy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($NewSize -lt 10*1024*1024*1024)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $NewSize=10*1024*1024*1024&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $StringNewSize=[string]$NewSize + "m"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $message="Resizing Volume SnapMirror destination volume " + $SecondaryVolume + " with value: " + $StringNewSize&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get-WFALogger -Info -message $($message)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set-NaVolSize -Name $SecondaryVolume -NewSize $StringNewSize&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 07:56:16 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/Hopefully-simple-PowerShell-question/m-p/74939#M15588</guid>
      <dc:creator>jont</dc:creator>
      <dc:date>2012-08-02T07:56:16Z</dc:date>
    </item>
  </channel>
</rss>

