VMware Cloud Community
NemanjaBe
Contributor
Contributor
Jump to solution

Create Multiple VM snapshots with VMware PowerCLI 10

Hello,

In the earlier version of PowerCLI 6.5 creating a snapshot on multiple VMs was very straightforward.

Example:

1) Group VMs: $VM1 = Get-VM VM1, VM2, VM3, VM4

2) Create snapshots on group VMs: New-Snapshot -VM $VM1 -Name "Your snapshot name" -Description "Your description".

Since from VMware PowerCLI version 10 'VM" parameter no longer accepts an array, this is no longer possible.

Can someone write me an example that can be used with PowerCLI 10?

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Use the pipeline

Get-VM VM1, VM2, VM3, VM4 |

New-Snapshot -Name "Your snapshot name" -Description "Your description".


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

5 Replies
LucD
Leadership
Leadership
Jump to solution

Use the pipeline

Get-VM VM1, VM2, VM3, VM4 |

New-Snapshot -Name "Your snapshot name" -Description "Your description".


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

NemanjaBe
Contributor
Contributor
Jump to solution

Thank you LucD for your fast and accurate answer. Smiley Happy

0 Kudos
jvunguyen1
Contributor
Contributor
Jump to solution

# https://virtualizationnation.com/2017/02/06/snapshot-removal-powercli/

$Authorization = Get-Credential -Message "Virtual Center Login, use your AD Admin account."

Connect-VIServer -Server abcvcenter.com -AllLinked -Credential $Authorization

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

#New-Snapshot -VM $vmlist -Name NameOfSnsphot -Description DescriptionOfSnapshot.

New-Snapshot -VM $vmlist -Name NameOfSnsphot -Description DescriptionOfSnapshot.

New-Snapshot -VM servername -Name "Server Snapshot" -Description "Server Snaphot"


# $vmlist = Get-Content C:\Servers.txt
# Get-VM $vmlist | Get-Snapshot | Remove-Snapshot -Confirm:$false

 

To remove the snapshots
Get-VM servername | Get-Snapshot | Remove-Snapshot -Confirm:$false -RemoveChildren

 

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you actually read the question?
Your solution (?) is in fact the problem


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
VirtualRalph
Contributor
Contributor
Jump to solution

Did you ever reach a solution to this?

0 Kudos