<?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: need to store volume size in a stored volume name read from  powershell read-host in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/need-to-store-volume-size-in-a-stored-volume-name-read-from-powershell-read-host/m-p/120865#M4871</link>
    <description>&lt;P&gt;Once you have the volume name, retrive it's properties using the "Get-NaVol" cmdlet...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Write-Host "Choose the source volume which needs to have DR"
$Source_Vol_Name = Read-Host

$Source_Vol = Get-NcVol -Name $Source_Vol_Name&lt;/PRE&gt;&lt;P&gt;The size of the volume would then be accessible using "$Source_Vol.SizeTotal".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
    <pubDate>Fri, 01 Jul 2016 14:05:28 GMT</pubDate>
    <dc:creator>asulliva</dc:creator>
    <dc:date>2016-07-01T14:05:28Z</dc:date>
    <item>
      <title>need to store volume size in a stored volume name read from  powershell read-host</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/need-to-store-volume-size-in-a-stored-volume-name-read-from-powershell-read-host/m-p/120842#M4868</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am writing a powershell script, where I want the user to input all the source and destination info.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am collecting the source volume from read-host .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once the source volume is choosen, I need to &amp;nbsp;store the choosen volume size in a variable so that destination volume can be created with the same size.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please check the code and suggest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;SAMPLE CODE:&lt;/P&gt;
&lt;P&gt;=============&lt;/P&gt;
&lt;P&gt;# Script to check and initiate snapmirror process for 7M&lt;BR /&gt;Import-Module DataONTAP&lt;BR /&gt;write-host "Enter the FQDN/IP of the source controller"&lt;BR /&gt;$Source_Controller = read-host&lt;BR /&gt;$cred = Get-Credential "root"&lt;BR /&gt;write-host "Source Controller Name= $Source_Controller"&lt;BR /&gt;write-host "==========================================="&lt;BR /&gt;Connect-NaController $Source_Controller -Credential $cred&lt;BR /&gt;&lt;BR /&gt;Write-Host "Snapmirror process will be started"&lt;BR /&gt;Get-NaVolSpace | ft Volume,VolumeSize,@{Name="VolSize(GB)";expression={$_.volumesize/1GB}} -AutoSize&lt;BR /&gt;Write-Host "Choose the source volume which needs to have DR"&lt;BR /&gt;$Source_Vol = Read-Host.name&lt;BR /&gt;Write-Host " $Source_Vol is choosen for which DR has to be configured"&lt;/P&gt;
&lt;P&gt;write-host "Enter the FQDN/IP of the Destination/DR controller"&lt;BR /&gt;$DR_controller = read-host&lt;BR /&gt;write-host "DR Controller Name=$DR_controller"&lt;BR /&gt;write-host "=================================="&lt;BR /&gt;Connect-NaController $DR_controller -Credential $cred&lt;/P&gt;
&lt;P&gt;Write-Host "choose the aggregate where you want the DR volume to be created"&lt;BR /&gt;Get-NaAggr | ft Name,State,TotalSize,Used,Available,@{Name="Totalsize(GB)";expression={$_.TotalSize/1GB}},@{Name="AvailableSize(GB)";expression={$_.Available/1GB}}&lt;BR /&gt;$DR_Aggr = Read-Host&lt;/P&gt;
&lt;P&gt;Write-Host " Source controller: $source_controller,Source volume: $Source_Vol, DR Controller: $DR_controller,DR_Aggr: $DR_Aggr are choosen as the vol/Aggr for DR creation" -ForegroundColor DarkGreen&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Write-Host " Creating DR volume in DR controller"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 20:08:32 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/need-to-store-volume-size-in-a-stored-volume-name-read-from-powershell-read-host/m-p/120842#M4868</guid>
      <dc:creator>ARB</dc:creator>
      <dc:date>2025-06-04T20:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: need to store volume size in a stored volume name read from  powershell read-host</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/need-to-store-volume-size-in-a-stored-volume-name-read-from-powershell-read-host/m-p/120865#M4871</link>
      <description>&lt;P&gt;Once you have the volume name, retrive it's properties using the "Get-NaVol" cmdlet...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Write-Host "Choose the source volume which needs to have DR"
$Source_Vol_Name = Read-Host

$Source_Vol = Get-NcVol -Name $Source_Vol_Name&lt;/PRE&gt;&lt;P&gt;The size of the volume would then be accessible using "$Source_Vol.SizeTotal".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2016 14:05:28 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/need-to-store-volume-size-in-a-stored-volume-name-read-from-powershell-read-host/m-p/120865#M4871</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2016-07-01T14:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: need to store volume size in a stored volume name read from  powershell read-host</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/need-to-store-volume-size-in-a-stored-volume-name-read-from-powershell-read-host/m-p/120911#M4876</link>
      <description>&lt;P&gt;&lt;SPAN class="login-bold"&gt;Hello&amp;nbsp;&lt;A href="https://community.netapp.com/t5/user/viewprofilepage/user-id/8479" target="_self"&gt;asulliva&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thanks for the &amp;nbsp;details, have checked and it is working fine. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I got another small query,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;I need to have checks to make sure if the inputs provided in the program is not as desired it should exit. Can you suggest a best way of doing it&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jul 2016 07:00:27 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/need-to-store-volume-size-in-a-stored-volume-name-read-from-powershell-read-host/m-p/120911#M4876</guid>
      <dc:creator>ARB</dc:creator>
      <dc:date>2016-07-04T07:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: need to store volume size in a stored volume name read from  powershell read-host</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/need-to-store-volume-size-in-a-stored-volume-name-read-from-powershell-read-host/m-p/121173#M4909</link>
      <description>&lt;P&gt;The simplest is probably a regular expression...something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;"abc123ABC" -match "^[a-zA-Z0-9]*$"&lt;/PRE&gt;&lt;P&gt;Which will return true if the string is only lower case, upper case, or numbers...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$string = "abc123ABC"

if ($string -match "^[a-zA-Z0-9]*$") {
    Write-Output "This is a positive match"
} else {
    Write-Output "This is a negative match"
}&lt;/PRE&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jul 2016 15:23:06 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/need-to-store-volume-size-in-a-stored-volume-name-read-from-powershell-read-host/m-p/121173#M4909</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2016-07-11T15:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: need to store volume size in a stored volume name read from  powershell read-host</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/need-to-store-volume-size-in-a-stored-volume-name-read-from-powershell-read-host/m-p/121191#M4913</link>
      <description>&lt;P&gt;Thanks for the details. got the idea to execute&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 03:02:32 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/need-to-store-volume-size-in-a-stored-volume-name-read-from-powershell-read-host/m-p/121191#M4913</guid>
      <dc:creator>ARB</dc:creator>
      <dc:date>2016-07-12T03:02:32Z</dc:date>
    </item>
  </channel>
</rss>

