<?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 Powershell: Remove a Volume that is in a VolumeCollection? in Application Integration</title>
    <link>https://community.hpe.com/t5/application-integration/powershell-remove-a-volume-that-is-in-a-volumecollection/m-p/6982750#M275</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a powershell script that is refreshing volumes, but has one flaw.&lt;/P&gt;&lt;P&gt;I want to drop a volume (let's say for a test box) and then create a clone from a snapshot (let's say the latest Production Snapshot).&lt;/P&gt;&lt;P&gt;To delete the volume I have to remove it from the volume collection first.&amp;nbsp; A pain...and it really isn't automated this way.&lt;/P&gt;&lt;P&gt;So it would be great if I could remove the volume from the powershell script or force the delete on the volume.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anybody done this? &lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Apr 2015 16:26:16 GMT</pubDate>
    <dc:creator>adamscabana128</dc:creator>
    <dc:date>2015-04-24T16:26:16Z</dc:date>
    <item>
      <title>Powershell: Remove a Volume that is in a VolumeCollection?</title>
      <link>https://community.hpe.com/t5/application-integration/powershell-remove-a-volume-that-is-in-a-volumecollection/m-p/6982750#M275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a powershell script that is refreshing volumes, but has one flaw.&lt;/P&gt;&lt;P&gt;I want to drop a volume (let's say for a test box) and then create a clone from a snapshot (let's say the latest Production Snapshot).&lt;/P&gt;&lt;P&gt;To delete the volume I have to remove it from the volume collection first.&amp;nbsp; A pain...and it really isn't automated this way.&lt;/P&gt;&lt;P&gt;So it would be great if I could remove the volume from the powershell script or force the delete on the volume.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anybody done this? &lt;/P&gt;&lt;P&gt;Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Apr 2015 16:26:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/application-integration/powershell-remove-a-volume-that-is-in-a-volumecollection/m-p/6982750#M275</guid>
      <dc:creator>adamscabana128</dc:creator>
      <dc:date>2015-04-24T16:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell: Remove a Volume that is in a VolumeCollection?</title>
      <link>https://community.hpe.com/t5/application-integration/powershell-remove-a-volume-that-is-in-a-volumecollection/m-p/6982751#M276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeff,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In NimbleOS 2.3, there are REST APIs available that you can use to do exactly this.&amp;nbsp; (I have a blog post coming soon that explains this in more detail.)&amp;nbsp; The following PowerShell code will call the API and do exactly what you need.&amp;nbsp; It first modifies the volume to take it offline and set its volcoll id to an empty string. This disassociates the volume from the volcoll.&amp;nbsp; Then it makes another API call to delete the volume once it's offline:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;param([string]$vol="")&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if ($vol -eq "") {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; write-host "`n`nUsage: delete-volume &amp;lt;VOLUME&amp;gt;`n`n";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; exit&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;###########################&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;# Enable HTTPS&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;###########################&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;###########################&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;# Get Token&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;###########################&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$array = "&amp;lt;ARRAYNAME&amp;gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$username = "admin"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$password = "&amp;lt;PASSWORD&amp;gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$data = @{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; username = $username&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; password = $password&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$body = convertto-json (@{ data = $data })&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN&gt;$uri = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://" rel="nofollow"&gt;https://&lt;/A&gt;&lt;SPAN&gt;" + $array + ":5392/v1/tokens"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$token = Invoke-RestMethod -Uri $uri -Method Post -Body $body&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$token = $token.data.session_token&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;###########################&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;# Find a Volume by Name&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;###########################&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$header = @{ "X-Auth-Token" = $token }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN&gt;$uri = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://" rel="nofollow"&gt;https://&lt;/A&gt;&lt;SPAN&gt;" + $array + ":5392/v1/volumes"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$volume_list = Invoke-RestMethod -Uri $uri -Method Get -Header $header&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;foreach ($volume_id in $volume_list.data.id){&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN&gt;&amp;nbsp; $uri = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://" rel="nofollow"&gt;https://&lt;/A&gt;&lt;SPAN&gt;" + $array + ":5392/v1/volumes/" + $volume_id&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $volume = Invoke-RestMethod -Uri $uri -Method Get -Header $header&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if ($volume.data.name -eq $vol){&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $vol_id = $volume.data.id&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;write-host "`n`nDeleting volume $vol with ID: $vol_id`n";&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;#########################################&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;# Offline a Volume and Disassociate from volcoll&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;#########################################&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$data = @{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; online = "false"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; force = "true"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; volcoll_id = ""&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$body = convertto-json (@{ data = $data })&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$header = @{ "X-Auth-Token" = $token }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN&gt;$uri = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://" rel="nofollow"&gt;https://&lt;/A&gt;&lt;SPAN&gt;" + $array + ":5392/v1/volumes/" + $vol_id&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$result = Invoke-RestMethod -Uri $uri -Method Put -Body $body -Header $header&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;###########################&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;# Delete a Volume&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;###########################&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$header = @{ "X-Auth-Token" = $token }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN&gt;$uri = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://" rel="nofollow"&gt;https://&lt;/A&gt;&lt;SPAN&gt;" + $array + ":5392/v1/volumes/" + $vol_id&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$result = Invoke-RestMethod -Uri $uri -Method Delete -Header $header&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Julian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2015 15:43:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/application-integration/powershell-remove-a-volume-that-is-in-a-volumecollection/m-p/6982751#M276</guid>
      <dc:creator>jcates98</dc:creator>
      <dc:date>2015-07-21T15:43:03Z</dc:date>
    </item>
  </channel>
</rss>

