VMware Cloud Community
vmk2014
Expert
Expert
Jump to solution

Snapshot for lists of Specific VM's from the lists and delete the snapshot after upgrade

Hi Everyone,

Can we take Snapshot for lists of Specific critical VM's from the lists and delete the snapshot after VM HW upgrade?

thanks

vmk

Tags (1)
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Taking a snapshot before the HW upgrade is quite straightforward.

$vmNames = Get-Content -Path .\vmnames.txt

Get-VM -Name $vmNames | New-Snapshot -Name "PreHWUpgrade" -Description "SNapshot taken before HW upgrade" -Confirm:$false

Cleaning up after the upgrade is also quite simple.

$vmNames = Get-Content -Path .\vmnames.txt

Get-VM -Name $vmNames | Get-Snapshot -Name "PreHWUpgrade" | Remove-Snapshot -Confirm:$false

But you will have to run the 2 script yourself.

There is no option to run the 2nd one for example, automatically after the HW upgrade.


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

View solution in original post

0 Kudos
11 Replies
LucD
Leadership
Leadership
Jump to solution

Taking a snapshot before the HW upgrade is quite straightforward.

$vmNames = Get-Content -Path .\vmnames.txt

Get-VM -Name $vmNames | New-Snapshot -Name "PreHWUpgrade" -Description "SNapshot taken before HW upgrade" -Confirm:$false

Cleaning up after the upgrade is also quite simple.

$vmNames = Get-Content -Path .\vmnames.txt

Get-VM -Name $vmNames | Get-Snapshot -Name "PreHWUpgrade" | Remove-Snapshot -Confirm:$false

But you will have to run the 2 script yourself.

There is no option to run the 2nd one for example, automatically after the HW upgrade.


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

0 Kudos
vmk2014
Expert
Expert
Jump to solution

Yes, I'm looking to run the script manually post upgrade. Does the script take the snapshot with Memory?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

No, but you can add that switch

$vmNames = Get-Content -Path .\vmnames.txt

Get-VM -Name $vmNames |

New-Snapshot -Name "PreHWUpgrade" -Description "SNapshot taken before HW upgrade" -Memory:$true -Confirm:$false


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

vmk2014
Expert
Expert
Jump to solution

While deleting the snapshot with memory any change in your script?

0 Kudos
LucD
Leadership
Leadership
Jump to solution

No, that part stays the same


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

0 Kudos
vmk2014
Expert
Expert
Jump to solution

I tested the VM Snapshot and tt worked for me. I'm planning to take a snapshot for Critical prod VM's while upgrading the VM version.

0 Kudos
vmk2014
Expert
Expert
Jump to solution

LucD,

Post HW version upgrade, I'm unable to delete one of the snapshots. It failing with error "The operation is not allowed in the current state."

thanks

vmk

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Did you change any of the HW settings between the snapshot and now?

For example, removed or changed a vNIC configuration.


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

0 Kudos
vmk2014
Expert
Expert
Jump to solution

No, i didn't change any HW config. I'm able to fix it by restarting the management agent of the host.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

That is strange.
Perhaps a 2nd restart of the VM after the HW upgrade could also fix the issue?


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

0 Kudos
vmk2014
Expert
Expert
Jump to solution

Yes, i was also thinking the same way but since I was not having downtime, hence went for management service restart.

0 Kudos