Colchester_Institute
asked on
Powershell script to automatically delete Snapshots in VMWare
Hi there
I'm looking for a script that will delete the Snapshots on our VM machines..I've read somewhere that this can be done with powershell but not sure where to start looking etc
Many thanks
I'm looking for a script that will delete the Snapshots on our VM machines..I've read somewhere that this can be done with powershell but not sure where to start looking etc
Many thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi
Sorry i dont have much time right now, but you don need to know perl, the script is created, you just need to use perl script.pl and add the credentials from your vCenter or ESX host.
But latter on, i can take a look with more time, and give detail information
Sorry for now
Jail
Sorry i dont have much time right now, but you don need to know perl, the script is created, you just need to use perl script.pl and add the credentials from your vCenter or ESX host.
But latter on, i can take a look with more time, and give detail information
Sorry for now
Jail
ASKER
Hi Bestway
No i can see the script is already there in Pearl, However I dont like using scripts of which i have no knowledge of, I have some use of Powershell and so can follow most scripts and understand them, thats why i dont want to use the Pearl one.
I'm sure it possibly works fine for what i want but as a solution for me personally that option is a no no :-)
If you get the time to find your script (powershell?) then i'd appreciate it...cheers
No i can see the script is already there in Pearl, However I dont like using scripts of which i have no knowledge of, I have some use of Powershell and so can follow most scripts and understand them, thats why i dont want to use the Pearl one.
I'm sure it possibly works fine for what i want but as a solution for me personally that option is a no no :-)
If you get the time to find your script (powershell?) then i'd appreciate it...cheers
hi
i will check script and test
Also i will try to find the script
Jail
i will check script and test
Also i will try to find the script
Jail
Hi
I have change the script. I have tested and it works. This is a simple script, do not check the VM state before, etc., just check the VMs and snapshots and removed.
I can create a better one tomorrow.
Jail
I have change the script. I have tested and it works. This is a simple script, do not check the VM state before, etc., just check the VMs and snapshots and removed.
I can create a better one tomorrow.
Jail
$server = "servername"
$user = "user"
$pwd = "password"
Connect-VIServer $server -User $user -Password $pwd
$AllVirtualMachines = Get-VM
foreach ($VirtualMachine in $AllVirtualMachines)
{$AllSnapshots=Get-Snapshot -VM $VirtualMachine
foreach ($Snapshot in $AllSnapshots)
{If ($Snapshot.ID -like "VirtualMachineSnapshot-*")
{Write-Host $VirtualMachine.Name, $Snapshot.Name, $Snapshot.Description
Remove-Snapshot -snapshot $Snapshot -RemoveChildren } } }
ASKER
Am i right in assuming that i need Power CLi installed
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I dont know ESX or Peral (so script no use to me there)
and the last link is pretty much a good reference but couldnt find any info on scripting what i need (info was good mind you)
I guess i just need to work out how to get one of the two scripts on from the first link working?