intial description
Pre-reuisites are as below:
1. Powercli must be installed on the server from where you will run this script.
2. Vcenter must be accessible from there.
3. You need to export your credentials in xml using export-clixml powershell command.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
import-module vmware.vimautomation.core
$cred=Import-Clixml -Path 'C:\jitendra.xml'
Connect-VIServer vmwarediary_vcsa -Credential $cred
$vmNames = Get-Content -Path C:\servers.txt
Get-VM -Name $vmNames | get-snapshot | Where-Object {$_.Created -lt (Get-Date).AddDays(-60)} | Remove-Snapshot -confirm:$false -verbose
------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you have any query, please send us an email on jitendra.k.singh.october13@gmail.com. I will try to reply as soon as possible.
Please take benefit of this script and try to let others to take the same benefit.