Powercli batch create and delete VM snapshots

Source: Internet
Author: User

Powercli batch create and delete VM snapshots
Note: 1. The client needs to install vmware powercli client 2. users connected to vcenter or esxi hosts must have the permission to connect to and create and delete snapshots 1. Create a VM snapshot # Add a vmware module commandAdd-PSSnapin-Name * vmware * # Fill in connection information, enter the vcenter/esxi Server ip address username and password as required $ vcenterip = Read-Host "Enter the vcenter/esxi Server ip address ...... "$ domainname = Read-Host" Please enter domain name. No value can be left blank ...... "$ username = Read-Host" Enter the user name ...... "$ userpassword = Read-Host" enter the password ....... "-AsSecureStringConnect-VIServer-Server $ vcenterip-User $ username-Password $ userpassword # Takes a snapshot of all virtual machines on the windows system. The snapshot name is test; get-vm | where {$ _. guest-like "* Windows *"} | where {$ _. powerState-eq "PoweredOn"} | New-Snapshot-Name "test" # output the Snapshot information of the vm get-vm | Get-Snapshot | Select-Object vm, name 2. delete a VM snapshot # Add a vmware module commandAdd-PSSnapin-Name * vmware * # enter the connection information, enter the vcenter/esxi Server ip address username and password as required $ vcenterip = Read-Host "Enter the vcenter/esxi Server ip address ...... "$ domainname = Read-Host" Please enter domain name. No value can be left blank ...... "$ username = Read-Host" Enter the user name ...... "$ userpassword = Read-Host" enter the password ....... "-AsSecureStringConnect-VIServer-Server $ vcenterip-User $ username-Password $ userpassword # delete a vm snapshot by snapshot name get-vm | get-snapshot-name" 20150908 "| remove-snapshot

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.