<?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: Remove snapshots using script in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2959114#M111176</link>
    <description>&lt;P&gt;What do you mean by "general"?&lt;BR /&gt;Remove all snapshots?&lt;/P&gt;</description>
    <pubDate>Tue, 14 Mar 2023 16:12:07 GMT</pubDate>
    <dc:creator>LucD</dc:creator>
    <dc:date>2023-03-14T16:12:07Z</dc:date>
    <item>
      <title>Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2304297#M82207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created snapshots for many VMs with the description:"Prior to install VM Hardware"&lt;/P&gt;&lt;P&gt;Can someone please tell me how to remove those snapshots that has a description : "Prior to install VM Hardware"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$vmlist = Get-Content "C:\VM\Snapshots\vmlists.txt"&lt;/P&gt;&lt;P&gt;foreach($VM in $VMlist) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get-Snapshot -VM $vm | &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Remove-Snapshot -Confirm:$false&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;Disconnect-VIServer -Confirm:$false &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2020 20:59:04 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2304297#M82207</guid>
      <dc:creator>Vimal348</dc:creator>
      <dc:date>2020-09-15T20:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2304298#M82208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="color: #4876d6;"&gt;$vmlist&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #0c969b;"&gt;Get-Content&lt;/SPAN&gt; &lt;SPAN style="color: #111111;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #c96765;"&gt;C:\VM\Snapshots\vmlists.txt&lt;/SPAN&gt;&lt;SPAN style="color: #111111;"&gt;"&lt;/SPAN&gt;&lt;P&gt;&lt;SPAN style="color: #994cc3; font-style: italic;"&gt;foreach&lt;/SPAN&gt;(&lt;SPAN style="color: #4876d6;"&gt;$VM&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3; font-style: italic;"&gt;in&lt;/SPAN&gt; &lt;SPAN style="color: #4876d6;"&gt;$VMlist&lt;/SPAN&gt;) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0c969b;"&gt;Get-Snapshot&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3;"&gt;-&lt;/SPAN&gt;VM &lt;SPAN style="color: #4876d6;"&gt;$vm&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3;"&gt;-&lt;/SPAN&gt;Name &lt;SPAN style="color: #111111;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #c96765;"&gt;Prior to install VM Hardware&lt;/SPAN&gt;&lt;SPAN style="color: #111111;"&gt;'&lt;/SPAN&gt; &lt;SPAN style="color: #0c969b;"&gt;|&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0c969b;"&gt;Remove-Snapshot&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3;"&gt;-&lt;/SPAN&gt;Confirm:&lt;SPAN style="color: #4876d6;"&gt;$false&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0c969b;"&gt;Disconnect-VIServer&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3;"&gt;-&lt;/SPAN&gt;Confirm:&lt;SPAN style="color: #4876d6;"&gt;$false&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2020 21:31:42 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2304298#M82208</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2020-09-15T21:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2304299#M82209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;B&gt;LucD&lt;/B&gt;​,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your script. Your suggestion works for the snapshot that has the name: '&lt;SPAN style="color: #565656; font-family: Metropolis, 'Avenir Next', 'Helvetica Neue', Arial, sans-serif; font-size: 13px;"&gt;Prior to install VM Hardware',&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #565656; font-family: Metropolis, 'Avenir Next', 'Helvetica Neue', Arial, sans-serif; font-size: 13px;"&gt;Here my snapshot names are different for each VMs, but Description is same : '&lt;SPAN style="color: #565656; font-family: Metropolis, 'Avenir Next', 'Helvetica Neue', Arial, sans-serif; font-size: 13px;"&gt;Prior to install VM Hardware',&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hence, is it possible to delete the snapshot collecting that Description name: '&lt;SPAN style="color: #565656; font-family: Metropolis, 'Avenir Next', 'Helvetica Neue', Arial, sans-serif; font-size: 13px;"&gt;Prior to install VM Hardware',&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://snipboard.io/6vHgME.jpg" title="https://snipboard.io/6vHgME.jpg"&gt;Upload and share screenshots and images - print screen online | Snipboard.io&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2020 21:50:41 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2304299#M82209</guid>
      <dc:creator>Vimal348</dc:creator>
      <dc:date>2020-09-15T21:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2304300#M82210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Then you could try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN style="color: #4876d6;"&gt;$vmlist&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="color: #0c969b;"&gt;Get-Content&lt;/SPAN&gt; &lt;SPAN style="color: #111111;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #c96765;"&gt;C:\VM\Snapshots\vmlists.txt&lt;/SPAN&gt;&lt;SPAN style="color: #111111;"&gt;"&lt;/SPAN&gt;&lt;P&gt;&lt;SPAN style="color: #994cc3; font-style: italic;"&gt;foreach&lt;/SPAN&gt;(&lt;SPAN style="color: #4876d6;"&gt;$VM&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3; font-style: italic;"&gt;in&lt;/SPAN&gt; &lt;SPAN style="color: #4876d6;"&gt;$VMlist&lt;/SPAN&gt;) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0c969b;"&gt;Get-Snapshot&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3;"&gt;-&lt;/SPAN&gt;VM &lt;SPAN style="color: #4876d6;"&gt;$vm&lt;/SPAN&gt; &lt;SPAN style="color: #0c969b;"&gt;|&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3; font-style: italic;"&gt;where&lt;/SPAN&gt;{$_&lt;SPAN style="color: #4876d6;"&gt;.Description&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3;"&gt;-eq&lt;/SPAN&gt; &lt;SPAN style="color: #111111;"&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #c96765;"&gt;Prior to install VM Hardware&lt;/SPAN&gt;&lt;SPAN style="color: #111111;"&gt;'&lt;/SPAN&gt;} &lt;SPAN style="color: #0c969b;"&gt;|&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0c969b;"&gt;Remove-Snapshot&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3;"&gt;-&lt;/SPAN&gt;Confirm:&lt;SPAN style="color: #4876d6;"&gt;$false&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0c969b;"&gt;Disconnect-VIServer&lt;/SPAN&gt; &lt;SPAN style="color: #994cc3;"&gt;-&lt;/SPAN&gt;Confirm:&lt;SPAN style="color: #4876d6;"&gt;$false&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2020 21:55:24 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2304300#M82210</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2020-09-15T21:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2304301#M82211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you LucD&lt;/P&gt;&lt;P&gt;The script works perfectly...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Sep 2020 00:49:58 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2304301#M82211</guid>
      <dc:creator>Vimal348</dc:creator>
      <dc:date>2020-09-16T00:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2959086#M111171</link>
      <description>&lt;P&gt;what is a general script i can use to delete snapshot from my environment?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 13:37:15 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2959086#M111171</guid>
      <dc:creator>ansar2</dc:creator>
      <dc:date>2023-03-14T13:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2959114#M111176</link>
      <description>&lt;P&gt;What do you mean by "general"?&lt;BR /&gt;Remove all snapshots?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Mar 2023 16:12:07 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2959114#M111176</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-03-14T16:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2964109#M111572</link>
      <description>&lt;P&gt;Hello Luc,&lt;/P&gt;&lt;P&gt;Quick question please can we remove Snapshot from the listed VMs but based on Date and time of the snap wich should be listed&amp;nbsp; into the CVS file ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Exemple for the Csv VM Name / Date&amp;nbsp; / Time of Snap Creation /&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 10:34:33 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2964109#M111572</guid>
      <dc:creator>Jocker-H</dc:creator>
      <dc:date>2023-04-17T10:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2964113#M111573</link>
      <description>&lt;P&gt;The object returned by Get-Snapshot contains a property Created.&lt;BR /&gt;You could use a Where-clause to only select the snapshot corresponding with a specific DateTime.&lt;BR /&gt;Just be aware that specifying the correct time in your CSV might be inaccurate since a DateTime is very precise (sub-second).&lt;BR /&gt;I would approach this with a time interval based on the value in your CSV&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2023 11:39:14 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2964113#M111573</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-04-17T11:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2967512#M111904</link>
      <description>&lt;P&gt;&lt;EM&gt;Hello,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For me I create a 3 lines script to remove all snapshot older then 3 days, but it looks like the log file not working, I get nothing in the file.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Do you have any suggestion ?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Connect-VIServer -server blablabla&lt;/EM&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;$snapshot = Get-VM | Get-Snapshot | Where {$_.Created -lt (Get-Date).AddDays(-3)} | Out-File "C:\Temp\deletesnap\logs.txt" -Append&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;$snapshot | Remove-Snapshot -RemoveChildren -RunAsync -Confirm:$false | Out-File "C:\Temp\deletesnap\logs.txt" -Append&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 09 May 2023 12:23:19 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2967512#M111904</guid>
      <dc:creator>ChristianCGI</dc:creator>
      <dc:date>2023-05-09T12:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2967513#M111905</link>
      <description>&lt;P&gt;With the RunAsync switch the snapshot removal becomes a background task, and hence not producing any output.&lt;BR /&gt;&lt;BR /&gt;You could use Get-Task, wait till all background tasks are completed, and then capture the info in the object returned by Get-Task.&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2023 12:34:22 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2967513#M111905</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2023-05-09T12:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2967840#M111929</link>
      <description>&lt;P&gt;&lt;U&gt;This is a good thread.&lt;/U&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 17:44:00 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2967840#M111929</guid>
      <dc:creator>cool_breeze</dc:creator>
      <dc:date>2023-05-10T17:44:00Z</dc:date>
    </item>
    <item>
      <title>Re: Remove snapshots using script</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2967842#M111930</link>
      <description>&lt;P&gt;Hello, could you please share with us the script after the modification. Im intrest in it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2023 17:56:11 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Remove-snapshots-using-script/m-p/2967842#M111930</guid>
      <dc:creator>Jocker-H</dc:creator>
      <dc:date>2023-05-10T17:56:11Z</dc:date>
    </item>
  </channel>
</rss>

