rneloms's Posts

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.
You are the Man!!!!. That Fixed it by using the wild card.
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 descripti... See more...
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?
Here is what the code snippet looks like for me now: $vCenter = connect-viserver ATL4VCS01 $Date = Get-Date -Format "yyyy-MM-dd-HHmm" This is the report file $filelocation = "C:\temp\Snap... See more...
Here is what the code snippet looks like for me now: $vCenter = connect-viserver ATL4VCS01 $Date = Get-Date -Format "yyyy-MM-dd-HHmm" This is the report file $filelocation = "C:\temp\SnapsDeleted-$Date.csv" 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 So at this point I have replaced the line and this is the complete error I get when running it in debug: Cannot process argument transformation on parameter 'Datastore'. Strings as pipeline input are not supported. At :line:31 char:20 + $vm = $list | Get-VM <<<< | Sort-Object Cannot process argument transformation on parameter 'Datastore'. Strings as pipeline input are not supported. At :line:31 char:20 + $vm = $list | Get-VM <<<< | Sort-Object Value cannot be found for the mandatory parameter VM At :line:32 char:18 + $vm | Get-Snapshot <<<< | Where { $_.Description -like "Patch"} | Remove-Snapshot -Confirm:$false | Out-Null
I tried that and I get the below. "System.Management.Automation.ScriptBlock". At :line:32 char:20 + $vm | ForEach-Object <<<< Get-Snapshot | Where { $_.Description -like "Patch"}|Remove-Sn... See more...
I tried that and I get the below. "System.Management.Automation.ScriptBlock". At :line:32 char:20 + $vm | ForEach-Object <<<< Get-Snapshot | Where { $_.Description -like "Patch"}|Remove-Snapshot -Snapshot $_ -Confirm:$false | Out-Null
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 th... See more...
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