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!
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.
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
Take a look at this script that captures a screenshot for a specific VM:
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
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
What is the filename and format for the screenshot?
Screenshot will be captured as PNG image.
I've tried to take it,after the Task have been successfully executed I found following value
/vmfs/volumes/4acb13ba-589015d6-9aeb-001a6496f275/AT-WindowsXP-SP3/AT-Manager-screenshot-0.png
in
task.getTaskInfo().getResult().
Unfortunatelly I still can't retrieve image from ESX using HTTPS request.
Anybody solved that problem???
Any solution?
Any solution?
Yes, I found solution for my case.
After CreateScreenshot_Task becomes complete I invoke getResult method of the Task which returns UNC path of screenshot file on ESX host.
Then I open SFTP session to ESX, and copy screenshot.
Also I've tried to send different HTTPS request to ESX host in order to get screenshot image - no results.
The best of all would be that getResult return URL for HTTPS request or Task object should have any method for retrieving screenshot from ESX and removing scrrenshot file after retrieve.
You can also try the HTTP(s) Access to download the file. For more details, check out this blog on Web Based Datastore browser:
http://www.doublecloud.org/2010/06/web-based-datastore-browser-in-vsphere/
Steve JIN
Author of VMware VI and vSphere SDK (Prentice Hall)
Creator of open source vSphere (VI) Java API(Tutorial, Testimonials, Download, Samples, Forum)
Blog: DoubleCloud.ORG ( Top 10 Best Practices,[Object Model|http://www.doublecloud.org/2010/02/object-model-of-vmware-vsphere-api-a-big-picture-in-2-minutes/],[Common Mistakes|http://www.doublecloud.org/2010/01/31/common-mistakes-using-vmware-vi-and-vsphere-sdk/], Tiny REST API, Cloud Application Architecture)
Steve, thanks for reply, your blog is really helpfull for me.
But what is about retrieving screenshot in way described in javadoc of Web Service SDK:
What "managed object ID of VM oк snapshot" i should pass ???
Normally the managed object id is the value of the ManagedObjectReference referring to a managed object. In your case, it's the value of MOR to a VM or a snapshot.
Steve JIN
Author of VMware VI and vSphere SDK (Prentice Hall)
Creator of open source vSphere (VI) Java API(Tutorial, Testimonials, Download, Samples, Forum)
Blog: DoubleCloud.ORG ( Top 10 Best Practices,[Object Model|http://www.doublecloud.org/2010/02/object-model-of-vmware-vsphere-api-a-big-picture-in-2-minutes/],[Common Mistakes|http://www.doublecloud.org/2010/01/31/common-mistakes-using-vmware-vi-and-vsphere-sdk/], Tiny REST API, Cloud Application Architecture)
Thanks a lot, it works. vm.getMOR().getVal() returned ID of VM and https://esxhost/screen?id=ID returned screenshot.
I tried all the solutions above but it doesn't work for me.
What I'm trying to do is download the captured image so I can show it locally but I can't find a way of doing that using soap
When using the https://esxhost/screen?id=xxx, it is asking for the username and password.
Any idea ???
Thanks
Very detailed info is here:
http://www.doublecloud.org/2010/09/really-easy-ways-to-capture-vm-screenshot/
Steve Jin, author of VMware VI and vSphere SDK, creator of VI (vSphere) Java API (http://vijava.sf.net)