VMware Cloud Community
foster29
Contributor
Contributor
Jump to solution

command help

Hello all,

i learning VI tool kit as I go along but need some help. Can you please provide samples for reverting back to a specific snapshot? I'm using some sample code as a guide but it does not appear to work.

In addition if anyone has a example of the command to change the amount of ram allocated to a vm that would be helpful as well.

thanks,

pete

Reply
0 Kudos
1 Solution

Accepted Solutions
Niket
Enthusiast
Enthusiast
Jump to solution

Hi Pete,

To set a particular snapshot use the following script.

get-viserver -server

$vm = Get-VM -Name "VMName"

$snapshotname = $vm | Get-Snapshot -Name "Target-Snpsht"

$vm | get-snapshot -Name "Target-Snpsht" | where { $_.name -like $snapshotname.name } | %{ set-vm $vm -snapshot $snapshotname }

You can change the ram allocated to the VM using the cmdlet Set-VM.

I hope it works and resolve your issue.

Thanks

Niket

View solution in original post

Reply
0 Kudos
2 Replies
Niket
Enthusiast
Enthusiast
Jump to solution

Hi Pete,

To set a particular snapshot use the following script.

get-viserver -server

$vm = Get-VM -Name "VMName"

$snapshotname = $vm | Get-Snapshot -Name "Target-Snpsht"

$vm | get-snapshot -Name "Target-Snpsht" | where { $_.name -like $snapshotname.name } | %{ set-vm $vm -snapshot $snapshotname }

You can change the ram allocated to the VM using the cmdlet Set-VM.

I hope it works and resolve your issue.

Thanks

Niket

Reply
0 Kudos
halr9000
Commander
Commander
Jump to solution

I found a couple of good examples with a search of "[set-vm snapshot|http://communities.vmware.com/search.jspa?q=set-vm+snapshot&resultTypes=BLOG_POST&resultTypes=DOCUMENT&resultTypes=MESSAGE&resultTypes=BLOG&resultTypes=COMMUNITY&peopleEnabled=true&dateRange=all&communityID=2530&userID=&numResults=15&rankBy=10001]". (link to search results).

The same cmdlet is used for changing memory.

If you would like more detailed help, please explain what you have tried and paste the error messages or other output.

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000