Sunday, 5 April 2020

STEP BY STEP PRACTICALS - VMWARE - HOW TO CREATE A SNAPSHOT FROM VMWARE POWER CLI

VMWARE - HOW TO CREATE AND REMOVE A SNAPSHOT FROM VMWARE POWER CLI

 

Please follow the below steps to create snapshots via VMware Power CLI.

 

1) Connect to the VC by running the below command:-

Command:- Connect-VIServer IP Address of the VC of FQDN or the VC.

 

 

 

2) This would prompt you to Enter the Username and Password of the Virtual Center.

 

 

3) Once you are connected, it would show you the below prompt:-

 

 

4) You can get the list of all the VM by running the below command:-

 

Command:- Get-VM

 

 

5) In my example, I want to take the snapshot of all the 3 VM.

So to perform this, I will create a text file name Servers.txt which has the name of all the 3 servers and as an example, I am keeping it in C drive.

 

 

 

6) Now I have created a variable $vmlist and will store the contents of the file Servers.txt kept on the C Drive which has the names of the Servers for which we want the snapshot.

 

$vmlist = Get-Content C:\Servers.txt

 

7) You can check the Content of the file Servers.txt by running the below command:-

 

Command;- echo $vmlist 


 

8) Now to Create the snapshot you can run the below command:-

 Command:-  New-Snapshot -VM $vmlist -Name "$($vm.Name)_SNAPSHOT1" -description 'TEST-SNAPSHOT1' -Quiesce -Memory -Verbose

 

 9) The snapshot can be verified by going the going to the VC.

You can also check the same by running the command:-

Command :-  Get-Snapshot -VM $vmlist -Verbose

 

10) You can remove all the snaphsots for the servers - test1, test2 and test3 by running the below command:-

Command :- Get-Snapshot -VM $vmlist | Remove-Snapshot -Confirm:$false -Verbose



11) Now if you run the command to check the snapshots, it would not show you any snap-shot as it has been removed.

No comments:

Post a Comment