takeVMScreenshot.pl using vMA 4.0

takeVMScreenshot.pl using vMA 4.0

Ever run into issues with your VMs where you have some debugging information logged to the console and you want to take a screenshot of it using vSphere API?

Requirement

ESX(i) 4.0 (must execute against individual ESX(i) host and not vCenter)

vMA 4.0

Sample Execution:

[vi-admin@scofield ~]$ ./takeVMScreenshot.pl --server himalaya.primp-industries.com --username root --vmname William-XP
Enter password:

Initiating screenshot of William-XP ...
Successfully capture screenshot from William-XP!
Downloading "William-XP-screenshot-0.png" to "vm_screenshots/William-XP-screenshot-0.png"
Removing screenshot "William-XP-screenshot-0.png" from ESX(i) host ...

Here is what William-XP-screenshot-0.png looks like:

Attachments
Comments

Is it possible to make screenshot of RDP_session?

I'm not sure, you can easily test it. It'll capture the session that is currently open but I'm not sure about multiple sessions or RDP sessions.

=========================================================================

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

Twitter: @lamw

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

I've test it & i can capture only physically open session. So i can't catch RDP session (like Vmware View session, or sessions with servers hosted on ESX).

Maybe some kind of trick exist in your script to capture all sessions incl. RDP?

It'll be very useful.

Thanks a lot.

No special tricks in the script, this is using a feature exposed through VMware's APIs and it apparently only captures the open session.

=========================================================================

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

Twitter: @lamw

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

i am not getting the response as needed

sfvma:~ # ./takeVMScreenshot.pl --server xxx --username root  "vSphere Management Assistant"

Enter password:

Your ESXi host is fully licensed!

sfvma:~ #

Also the syntax "--vmname" does not work

Unknown option: vmname

For a summary of command usage, type './takeVMScreenshot.pl --help'.

For documentation, type 'perldoc ./takeVMScreenshot.pl'.

I tried to look for the screen shot but the dir i do not find

======================================================================================================================================================

sfvma:~ # ./takeVMScreenshot.pl --help

Synopsis: ./takeVMScreenshot.pl OPTIONS

Common VI options:

   --config (variable VI_CONFIG)

      Location of the VI Perl configuration file

   --credstore (variable VI_CREDSTORE)

      Name of the credential store file defaults to <HOME>/.vmware/credstore/vicredentials.xml on Linux and <APPDATA>/VMware/credstore/vicredentials.xml on Windows

   --encoding (variable VI_ENCODING, default 'utf8')

      Encoding: utf8, cp936 (Simplified Chinese), iso-8859-1 (German), shiftjis (Japanese)

   --help

      Display usage information for the script

   --passthroughauth (variable VI_PASSTHROUGHAUTH)

      Attempt to use pass-through authentication

   --passthroughauthpackage (variable VI_PASSTHROUGHAUTHPACKAGE, default 'Negotiate')

      Pass-through authentication negotiation package

   --password (variable VI_PASSWORD)

      Password

   --portnumber (variable VI_PORTNUMBER)

      Port used to connect to server

   --protocol (variable VI_PROTOCOL, default 'https')

      Protocol used to connect to server

   --savesessionfile (variable VI_SAVESESSIONFILE)

      File to save session ID/cookie to utilize

   --server (variable VI_SERVER, default 'localhost')

      VI server to connect to. Required if url is not present

   --servicepath (variable VI_SERVICEPATH, default '/sdk/webService')

      Service path used to connect to server

   --sessionfile (variable VI_SESSIONFILE)

      File containing session ID/cookie to utilize

   --url (variable VI_URL)

      VI SDK URL to connect to. Required if server is not present

   --username (variable VI_USERNAME)

      Username

   --verbose (variable VI_VERBOSE)

      Display additional debugging information

   --version

      Display version information for the script

Version history
Revision #:
1 of 1
Last update:
‎08-11-2009 10:30 PM
Updated by: