PowerCli script to delete snapshot of vms

Add-PSSnapin Vmware.Vimautomation.Core
# Enter your vCenter and credentials
$VIServer = "name of vCenter"

# Connect to vCenter using the variables above
Connect-VIServer -Server $VIServer

#Get Windows Guest machines from input file
$vmguests = Get-Content "C:\csv-files\input.txt"


#Write new config options to VMs
foreach ($vm in $vmguests){
       
        Get-Snapshot -vm $vm | Remove-Snapshot -Confirm:$false      
        
}

# Disconnect from vCenter
Disconnect-VIServer -Server $VIServer -Confirm:$false

No comments:

Post a Comment