VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 2 "helpful" answers available (6 pts)
4 Replies Last post: Nov 2, 2009 11:11 AM by jbugwadia  

create screenshot for a vm posted: Jun 8, 2009 2:51 PM

Click to view tshamul's profile Novice 8 posts since
Aug 2, 2007

hi.

I'm using vShpere web service SDK and i want to take a screenshot of my working vm.

I used the function CreateScreenshot_Task, the API returns that task had success, but i have no screenshot.

I have searched on the vmx folder in the ESX but it's also not there.

Maybe it's in some other place? may i set the output path (can it be on the client side?)

Thanks!

Re: create screenshot for a vm

1. Jun 8, 2009 3:36 PM in response to: tshamul
Click to view stumpr's profile Expert 451 posts since
Sep 26, 2007
I haven't actually tried it myself, so maybe someone else can provide more hands on information but I found this:

screenshotSupported	xsd:boolean	
Indicates whether the screenshot retrival over https is supported for this host's virtual machines. If true, a screenshot can be retrieved at the HTTPS relative path /screen?id=<managed object ID of virtual machine or snapshot>. If any of the optional parameters 'top', 'left', 'bottom', and 'right' is specified, the returned image will be cropped from the rectangle with upper left corner (left, top) and bottom right corner (right - 1, bottom - 1). These values default to the top, left, bottom and right edges of the image. The client must use an authenticated session with privilege VirtualMachine.Interact.ConsoleInteract on the requested virtual machine or, in the case of a snapshot, the virtual machine associated with that snapshot.
Since VI API 2.5


I found it under hostCapability. Looks like it would be off the host you created it on, so something like: https://esxhost/screen?id=vm1 for example. Should be able to build the string with a little code.

Re: create screenshot for a vm

2. Nov 2, 2009 10:21 AM in response to: stumpr
Click to view jbugwadia's profile Lurker 3 posts since
Jan 9, 2009
Hello,

I am having the same problem and would like to find a way to retrieve the VM screenshot. The CreateScreenshot_Task returns success but I am unable to find or retrieve the screenshot file. Were you able to get this to work?

I tried the URL (e.g. https://esxhost/screen?id=vm1) but do not get back any content. The "screenshotSupported" property is enabled for the host. I also searched the on the ESX host but do not see an image file.

What is the filename and format for the screenshot? Is there a way to retrieve the screenshot using vCenter?

Thanks!

Jim

Re: create screenshot for a vm

3. Nov 2, 2009 10:57 AM in response to: jbugwadia
Click to view lamw's profile Champion 2,822 posts since
Nov 27, 2007
Take a look at this script that captures a screenshot for a specific VM: takeVMScreenshot.pl using vMA 4.0

=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/
vGhetto Script Repository
VMware Code Central - Scripts/Sample code for Developers and Administrators
VMware Developer Comuunity
Getting Started with the vMA (tips/tricks)
Getting Started with the vSphere SDK for Perl
Twitter: @lamw

http://engineering.ucsb.edu/~duonglt/vmware/vexpert_silver_icon.jpg

If you find this information useful, please award points for "correct" or "helpful".

Re: create screenshot for a vm

4. Nov 2, 2009 11:11 AM in response to: lamw
Click to view jbugwadia's profile Lurker 3 posts since
Jan 9, 2009

Thanks for the pointer to the PERL script!

The script only allows execution against a ESX host. Is this SDK call not supported on vCenter? In the application I am developing, I have credentials to connect to vCenter but not the ESX host.

Jim


Developer Social Media

Communities