Connect-VIServer vsphereserver
Get-vm "guest vm" | get-snapshot |
Remove-Snapshot -confirm:$false
save it as something .ps1
Batch file:
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe
-psc "C:\Program Files (x86)\VMware\Infrastructure\vSphere
PowerCLI\vim.psc1" -c ". \"C:\Program Files
(x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-VIToolkitEnvironment.ps1\";C:\vmwarescript\yourpowershellscript"
Machine running this will need VMWare powercli installed.
If your user is not an admin that will be running the script as a scheduled task it will need logon as batch job and service rights and explicit rights to the CMD.exe file in C:\windows\system32.
No comments:
Post a Comment