<?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: Help figuring out flaw in a Snapshot removal script using an input file in VMware PowerCLI Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767454#M20595</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.vmware.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; Be patient with me. It is now reading the input file and it is also creating the report but it is not doing the most important part, removing the snapshot. I checked to make sure the description field does have patch which it does. The contents of the description field is"Patch Management 2010-04-28-0939".  Am I using the wrong command for Removing the snapshot?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 May 2010 16:45:04 GMT</pubDate>
    <dc:creator>rneloms</dc:creator>
    <dc:date>2010-05-06T16:45:04Z</dc:date>
    <item>
      <title>Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767448#M20589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to create a script that will make use of an input file that has the virtual machine names containing snapshots with a common name. I used some of the logic in the script to create the snapshots and I am trying to reverse engineer to delete them now. I have attached the delete script, the input file, and the create script. The create script works fines using the input file but I know my logic in the delete is flawed. Please let me know if you can see were the corrections is needed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 15:02:18 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767448#M20589</guid>
      <dc:creator>rneloms</dc:creator>
      <dc:date>2010-05-06T15:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767449#M20590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The loop where you get the snapshots first needs a VirtualMachineImpl object as input.&lt;/P&gt;&lt;P&gt;That's why I added the Get-VM to line where you initialise the $vm array.&lt;/P&gt;&lt;PRE __jive_macro_name="code"&gt;
...
# This is the input file for  snapshot creation script
$list = Get-Content C:\temp\vms.txt 

$vm = $list | Get-VM | Sort-Object 
$vm | Get-Snapshot | Where { $_.Description -like "Patch"} | Remove-Snapshot -Confirm:$false | Out-Null
...
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________&lt;/P&gt;&lt;P&gt;Blog: &lt;A href="http://lucd.info"&gt;LucD notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Twitter: &lt;A href="http://twitter.com/lucd22"&gt;lucd22&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 15:37:44 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767449#M20590</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2010-05-06T15:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767450#M20591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried that and I get the below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; "System.Management.Automation.ScriptBlock".&lt;/P&gt;&lt;P&gt;At :line:32 char:20&lt;/P&gt;&lt;P&gt;+ $vm | ForEach-Object &amp;lt;&amp;lt;&amp;lt;&amp;lt;  Get-Snapshot | Where { $_.Description -like "Patch"}|Remove-Snapshot -Snapshot $_ -Confirm:$false | Out-Null&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 15:42:01 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767450#M20591</guid>
      <dc:creator>rneloms</dc:creator>
      <dc:date>2010-05-06T15:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767451#M20592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to replace that line with the line I showed in the code snippet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________&lt;/P&gt;&lt;P&gt;Blog: &lt;A href="http://lucd.info"&gt;LucD notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Twitter: &lt;A href="http://twitter.com/lucd22"&gt;lucd22&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 16:02:16 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767451#M20592</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2010-05-06T16:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767452#M20593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is what the code snippet looks like for me now:&lt;/P&gt;&lt;P&gt;$vCenter = connect-viserver ATL4VCS01&lt;/P&gt;&lt;P&gt;$Date = Get-Date -Format "yyyy-MM-dd-HHmm"&lt;/P&gt;&lt;OL&gt;&lt;LI level="1" type="ol"&gt;&lt;P&gt;This is the report file&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;$filelocation = "C:\temp\SnapsDeleted-$Date.csv"&lt;/P&gt;&lt;OL&gt;&lt;LI level="1" type="ol"&gt;&lt;P&gt;This is the input file for  snapshot creation script&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;$list = Get-Content C:\temp\vms.txt &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$vm = $list | Get-VM | Sort-Object &lt;/P&gt;&lt;P&gt;$vm | Get-Snapshot | Where { $_.Description -like "Patch"} | Remove-Snapshot -Confirm:$false | Out-Null&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So at this point I have replaced the line and this is the complete error I get when running it in debug:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cannot process argument transformation on parameter 'Datastore'. Strings as pipeline input are not supported.&lt;/P&gt;&lt;P&gt;At :line:31 char:20&lt;/P&gt;&lt;P&gt;+ $vm = $list | Get-VM &amp;lt;&amp;lt;&amp;lt;&amp;lt;  | Sort-Object &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cannot process argument transformation on parameter 'Datastore'. Strings as pipeline input are not supported.&lt;/P&gt;&lt;P&gt;At :line:31 char:20&lt;/P&gt;&lt;P&gt;+ $vm = $list | Get-VM &amp;lt;&amp;lt;&amp;lt;&amp;lt;  | Sort-Object &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Value cannot be found for the mandatory parameter VM&lt;/P&gt;&lt;P&gt;At :line:32 char:18&lt;/P&gt;&lt;P&gt;+ $vm | Get-Snapshot &amp;lt;&amp;lt;&amp;lt;&amp;lt;  | Where { $_.Description -like "Patch"} | Remove-Snapshot -Confirm:$false | Out-Null&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 16:08:59 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767452#M20593</guid>
      <dc:creator>rneloms</dc:creator>
      <dc:date>2010-05-06T16:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767453#M20594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I see what went wrong the curly braces dropped off during my copy/paste.&lt;/P&gt;&lt;P&gt;I attach the updated script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________&lt;/P&gt;&lt;P&gt;Blog: &lt;A href="http://lucd.info"&gt;LucD notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Twitter: &lt;A href="http://twitter.com/lucd22"&gt;lucd22&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 16:24:55 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767453#M20594</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2010-05-06T16:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767454#M20595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.vmware.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; Be patient with me. It is now reading the input file and it is also creating the report but it is not doing the most important part, removing the snapshot. I checked to make sure the description field does have patch which it does. The contents of the description field is"Patch Management 2010-04-28-0939".  Am I using the wrong command for Removing the snapshot?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 16:45:04 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767454#M20595</guid>
      <dc:creator>rneloms</dc:creator>
      <dc:date>2010-05-06T16:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767455#M20596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to provide some meta characters with the -like operator when you're not looking for an exact match.&lt;/P&gt;&lt;P&gt;Try it like this (replace the line)&lt;/P&gt;&lt;PRE __jive_macro_name="code"&gt;
...
$vm | Get-Snapshot | Where { $_.Description -like "Patch*"} | Remove-Snapshot -Confirm:$false | Out-Null
...
&lt;/PRE&gt;&lt;P&gt;Now you saying that you are looking for text that starts with "Patch" and that you don't care what comes after that string (the asterisk after "Patch").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________&lt;/P&gt;&lt;P&gt;Blog: &lt;A href="http://lucd.info"&gt;LucD notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Twitter: &lt;A href="http://twitter.com/lucd22"&gt;lucd22&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 16:48:50 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767455#M20596</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2010-05-06T16:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767456#M20597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are the Man!!!!. That Fixed it by using the wild card.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 18:17:49 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767456#M20597</guid>
      <dc:creator>rneloms</dc:creator>
      <dc:date>2010-05-06T18:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767457#M20598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This type of script is exactly what I am looking for.  I modified the script based on the edits by LucD &lt;A href="vcenter name, search string, file location, list location"&gt;&lt;/A&gt;.  I ran it against one VM and it populated the .csv file correctly.  However, the screenshot was never deleted.  I get the following warning (see attached) but I don't think that should prevent it from running.  I am going to use VGC, &lt;A href="http://labs.vmware.com/flings/vgc" target="test_blank"&gt;http://labs.vmware.com/flings/vgc&lt;/A&gt;, since it packages other features and uses a GUI. I am hoping to have this script available to use if needed though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 May 2010 17:49:35 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767457#M20598</guid>
      <dc:creator>Matt_B1</dc:creator>
      <dc:date>2010-05-07T17:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767458#M20599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;VGC is a good tool, although it is still in preview.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The message you're seeing is a known problem.&lt;/P&gt;&lt;P&gt;See for example  &lt;SPAN __jive_macro_name="message" id="1458403"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;____________&lt;/P&gt;&lt;P&gt;Blog: &lt;A href="http://lucd.info"&gt;LucD notes&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Twitter: &lt;A href="http://twitter.com/lucd22"&gt;lucd22&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 May 2010 18:13:56 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767458#M20599</guid>
      <dc:creator>LucD</dc:creator>
      <dc:date>2010-05-07T18:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767459#M20600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That will not prevent the script from working but just in case here is my end result script as well. That I am runing successfully.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 May 2010 18:14:26 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767459#M20600</guid>
      <dc:creator>rneloms</dc:creator>
      <dc:date>2010-05-07T18:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help figuring out flaw in a Snapshot removal script using an input file</title>
      <link>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767460#M20601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks identical to my script but your version worked just fine several times.  I did manually update VIX, &lt;A href="http://www.vmware.com/support/developer/vix-api/" target="test_blank"&gt;http://www.vmware.com/support/developer/vix-api/&lt;/A&gt;, which should be unrelated but I might as well note that if anyone else still has an issue with your updated script.  Thanks again rneloms and LucD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 May 2010 20:45:47 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Help-figuring-out-flaw-in-a-Snapshot-removal-script-using-an/m-p/767460#M20601</guid>
      <dc:creator>Matt_B1</dc:creator>
      <dc:date>2010-05-07T20:45:47Z</dc:date>
    </item>
  </channel>
</rss>

