<?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: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139651#M5720</link>
    <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/8479"&gt;@asulliva&lt;/a&gt;&amp;nbsp;Thank you , thanks for the hashtable example,&amp;nbsp; was using Initialize-NcObjectProperty&lt;/P&gt;</description>
    <pubDate>Tue, 17 Apr 2018 16:22:57 GMT</pubDate>
    <dc:creator>SaravanaPandi</dc:creator>
    <dc:date>2018-04-17T16:22:57Z</dc:date>
    <item>
      <title>Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139301#M5700</link>
      <description>&lt;P&gt;Hi NetApp Admins, I am new to Netapp powershell and i has this confusion&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;volumes12.txt contains list of volumes&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;foreach( $vol in Get-Content ".\volumes12.txt") {&lt;BR /&gt;&amp;nbsp;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Get-NcVol $vol -Verbose&lt;/P&gt;
&lt;P&gt;Set-Ncvol $vol&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;None of the above commands seems to work,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;whereas if i do this through an array it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$volumelist = get-ncvol -Name *sqlvol1* | Select-Object $_.Volume&lt;BR /&gt; ForEach ($vol in $volumelist)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;Set-NcVol $vol -Offline -Verbose&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;at present i have lots of offline volumes in a text file, i want to to remove/destroy the volumes by reading that file&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 13:51:25 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139301#M5700</guid>
      <dc:creator>SaravanaPandi</dc:creator>
      <dc:date>2025-06-04T13:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139302#M5701</link>
      <description>&lt;P&gt;All those cmdlets take pipeline input&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so for example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;get-ncvol -Name *sqlvol1 | set-ncvol -offline | remove-ncvol -confirm:$false&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Your code doesn't work below and is confusing.. The above line will do the trick, and you don't need the vols in a file if you know the pattern&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you have the vols in a file like this&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;$vols = gc filenameofvols.txt&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;connect-nccontroller $controller -cred $cred&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;$vols | % {&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;get-ncvol $_&amp;nbsp; | set-ncvol -offline | remove-ncvol -confirm:$false&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 18:18:39 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139302#M5701</guid>
      <dc:creator>JGPSHNTAP</dc:creator>
      <dc:date>2018-04-02T18:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139303#M5702</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/57317"&gt;@SaravanaPandi&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you elaborate on what you're trying to do with the volumes?&amp;nbsp; It appears that you're issuing the Set-NcVol cmdlet with no options beyond the volume name, which won't result in any action.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Beyond that, as&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/11560"&gt;@JGPSHNTAP&lt;/a&gt;&amp;nbsp;mentioned, there are some things you can do to optimize the code and/or make it more PowerShell-like.&amp;nbsp; The pipeline is super helpful for these types of operations...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you'll want to make sure to specify the SVM name when querying the cluster for volumes.&amp;nbsp; The SVM is like a namespace, so it's possible to have multiple volumes that have the same name in different SVMs.&amp;nbsp; Using the cmdlet with just the volume name would return all instances.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 18:36:00 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139303#M5702</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2018-04-02T18:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139304#M5703</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/11560"&gt;@JGPSHNTAP&lt;/a&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/8479"&gt;@asulliva&lt;/a&gt;&amp;nbsp;- I skipped the setting up the&amp;nbsp; svm part, its not possible to offline the volume unless&amp;nbsp; we specify svm or set the svm property in the current controller context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wanted to do the offline the volumes the first day, and store the same offline volumes(which i did manually) in a text file(as backup, recording purposes) and remove the same volumes few days later from the file(offline volumes) as input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pipeline commands will be useful, but it will destroy the volume, and its difficult to get the volume back,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like a long process instead of simple one, but incase, we offlined one of the volumes incorrectly, just in case few days we can simply enable the volume back.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The reason is i may have 20 offline(which i did) volumes in the first day , may have 30 offline volumes(another storage admin might have offlined 10 more volumes) in the thirdday. wanted to destory only the 20 volumes volumes which i did offline, not someone else even if its a same pattern. That's why i wanted to use file as input&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 18:53:53 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139304#M5703</guid>
      <dc:creator>SaravanaPandi</dc:creator>
      <dc:date>2018-04-02T18:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139305#M5704</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/11560"&gt;@JGPSHNTAP&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$vols1 = gc ".\volumes15.txt"&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$vols1 | % {get-ncvol $_}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;SPAN&gt;$vols1 = gc ".\volumes15.txt" foreach ($vol in $vols1) { get-ncvol $vol}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;gives the same result, its reads only the end of the file, for example if i have 3 volumes its acts only on the the last line/3rd volume&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 19:02:37 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139305#M5704</guid>
      <dc:creator>SaravanaPandi</dc:creator>
      <dc:date>2018-04-02T19:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139306#M5705</link>
      <description>&lt;P&gt;In Ontap 9, destroying a volume isn't that bad anymore.&amp;nbsp; They have created a recovery que.&amp;nbsp; We adjust all our SVM's to 168hours, and we don't purge the recovery queue unless we are doing testing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would look into that because you are doing lots of extra work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, powershell is super flexible, you can code whatever you want and how you want...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 19:02:43 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139306#M5705</guid>
      <dc:creator>JGPSHNTAP</dc:creator>
      <dc:date>2018-04-02T19:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139308#M5706</link>
      <description>&lt;P&gt;$vols1 = gc ".\volumes15.txt"&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$vols1 | % {get-ncvol $_}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;SPAN&gt;$vols1 = gc ".\volumes15.txt" foreach ($vol in $vols1) { get-ncvol $vol}&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;gives the same result, its reads only the end of the file, for example if i have 3 volumes its acts only on the the last line/3rd volume&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;^^&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That's impossible.&amp;nbsp; Post your file&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 19:20:38 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139308#M5706</guid>
      <dc:creator>JGPSHNTAP</dc:creator>
      <dc:date>2018-04-02T19:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139323#M5707</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/11560"&gt;@JGPSHNTAP&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/8479"&gt;@asulliva&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your followup&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Import-Module Dataontap&lt;/P&gt;
&lt;P&gt;$ctrl = Read-Host -Prompt "Please enter your controller name!"&lt;BR /&gt;Connect-NcController $ctrl &lt;BR /&gt;$svm= Read-Host -Prompt "Please enter your svm!"&lt;BR /&gt;$global:CurrentNcController.Vserver =&amp;nbsp;$svm&lt;/P&gt;
&lt;P&gt;$vols12 = gc ".\volumes15.txt"&lt;/P&gt;
&lt;P&gt;ForEach ($vol1 in $vols12)&lt;BR /&gt;{&lt;BR /&gt;#Ignore the errors&lt;BR /&gt;#Write-Host $vol1&lt;BR /&gt;Get-NcVol -Name $vol1 -verbose -&amp;gt; This one did not show any error.or output&amp;nbsp;&lt;BR /&gt;# Set-NcVol $vol1 -Offline -Confirm -&amp;gt; Tried this one. apparently it looks like the ncvol commands have difficult in parsing the volumes one by one.&lt;/P&gt;
&lt;P&gt;write-host $vol1 -&amp;gt; Displays the volumes properly.&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Volumes in the text file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ora_sample_log_08232017&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ora_sample_&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;&lt;SPAN&gt;_08242017&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ora_sample_&lt;/SPAN&gt;&lt;SPAN&gt;log&lt;/SPAN&gt;&lt;SPAN&gt;_08252017&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the error for Set-Ncvol ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Set-NcVol : Invalid character ' ' in volume name. It can have '_' and alphanumeric characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;+ Set-NcVol $vol1 -Offline -Confirm&lt;BR /&gt;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt; + CategoryInfo : InvalidOperation: [Set-NcVol], EAPIERROR&lt;BR /&gt; + FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Volume.SetNcVol&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Getting the same error for toolkit version 4.2 and 4.3 as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Apr 2018 15:18:32 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139323#M5707</guid>
      <dc:creator>SaravanaPandi</dc:creator>
      <dc:date>2018-04-03T15:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139457#M5712</link>
      <description>&lt;P&gt;It seems that the Get-Content cmdlet is padding out each line to be the same length which is what's causing them to not work when iterating over the values in the resulting array.&amp;nbsp; This works for me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Get-Content $filename | %{
    Get-NcVol -Vserver $svmName -Name ($_.Trim())
}&lt;/PRE&gt;
&lt;P&gt;I simply added the ".Trim()" function call to the string object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&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, 09 Apr 2018 17:20:49 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139457#M5712</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2018-04-09T17:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139537#M5718</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/8479"&gt;@asulliva&lt;/a&gt;&amp;nbsp;Thats true. i opened the file in a spread sheet and saved again as a msdos file, it worked once. Again the get-content cmdlet didn't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Get-Content : Cannot bind argument to parameter 'Path' because it is an empty string.&lt;BR /&gt;At line:3 char:13&lt;BR /&gt;+ Get-Content $filename | %{&lt;BR /&gt;+ ~~~~~~~~~&lt;BR /&gt; + CategoryInfo : InvalidData: (:) [Get-Content], ParameterBindingValidationException&lt;BR /&gt; + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.GetContentCommand&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$filename contains&amp;nbsp;$filename = Get-Content .\volumes.txt, its a simple text file with two volumes listed one by one&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;throws above error if i tried the script mentioned by you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$volumes = get-content .\volumes1.txt (original file volumes.txt)&lt;BR /&gt; ForEach ($vol in $volumes)&lt;BR /&gt;{&lt;BR /&gt;Get-NcVol $vol -verbose&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;volumes.txt has 70 kb( 2 volume names) open this in a excel save as in msdos text file and save it as volumes1.txt, the file size changes. also the get-ncvol reads only 2 lines in the text file volumes1.txt as it supposed to.&lt;/P&gt;
&lt;P&gt;where as if i keep the volumes.txt as input it reads the two lines as well displays all volumes like a plain get-ncvol&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 09:48:35 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139537#M5718</guid>
      <dc:creator>SaravanaPandi</dc:creator>
      <dc:date>2018-04-12T09:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139545#M5719</link>
      <description>&lt;P&gt;The first error you're getting is because the value of $filename is invalid.&amp;nbsp; The value of the $filename variable should be either a canonical or relative path + filename for the text file which contains the volume names.&amp;nbsp; For example, here's how I generated my test volume list:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;# get 10 random, volumes which are not node or SVM root volumes&lt;BR /&gt;$volumes = Get-NcVserver $svmName | Get-NcVol -Attributes @{} -Query @{ VolumeStateAttributes = @{ IsNodeRoot = $false; IsVserverRoot = $false } } | Get-Random -Count 10 | Select-Object -ExpandProperty Name | Out-File ./volumes.txt

$volumes | Out-File "C:\Users\asulliva\Documents\volumes.txt"&lt;/PRE&gt;
&lt;P&gt;The result looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://community.netapp.com/t5/image/serverpage/image-id/8221i67D2018BC48AAAF7/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="2018-04-12 09_35_19-Windows PowerShell ISE.png" title="2018-04-12 09_35_19-Windows PowerShell ISE.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From there, I simply execute the code from above:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Get-Content ./volumes.txt | %{
    Get-NcVol -Vserver $svmName -Name $_.Trim()
}&lt;/PRE&gt;
&lt;P&gt;Resulting in...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://community.netapp.com/t5/image/serverpage/image-id/8222i5483570AFC6260F1/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="2018-04-12 09_40_48-Windows PowerShell ISE.png" title="2018-04-12 09_40_48-Windows PowerShell ISE.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second "error", or rather lack of correct output, is because you aren't using the trim function on the string being read from the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 13:53:39 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139545#M5719</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2018-04-12T13:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Get-Ncvol,Remove-Ncvol,Set-Ncvol from a file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139651#M5720</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/8479"&gt;@asulliva&lt;/a&gt;&amp;nbsp;Thank you , thanks for the hashtable example,&amp;nbsp; was using Initialize-NcObjectProperty&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 16:22:57 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Get-Ncvol-Remove-Ncvol-Set-Ncvol-from-a-file/m-p/139651#M5720</guid>
      <dc:creator>SaravanaPandi</dc:creator>
      <dc:date>2018-04-17T16:22:57Z</dc:date>
    </item>
  </channel>
</rss>

