Advertisement
Guest User

pcli-sf-031117

a guest
Nov 3rd, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. Import-module VMware.VimAutomation.core
  2.  
  3. $user = Read-Host 'Username'
  4. $password = Read-Host 'Password'
  5.  
  6. Connect-VIServer -Server vcenter6.esxlan.local -User $user -Password $password
  7.  
  8. echo "Voila la liste des Snapshots:"
  9.  
  10. get-vm | get-snapshot | where {$_.Name -match "MAJ-UNIX-*"}| Format-Table -Property VM,Name,Created,Description, SizeMB
  11.  
  12. $validation = Read-Host 'Pour supprimer les Snapshot tapez YES'
  13.  
  14. if ($validation -eq "YES")
  15. {
  16. get-vm | get-snapshot | where {$_.Name -match "MAJ-UNIX-*"}| Remove-Snapshot -Confirm:$false -RunAsync
  17. }
  18. else { "Vous n'avez pas validé" }
  19.  
  20. echo "Fin du script, les snapshots sont supprimés!"
  21. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement