How would one programmatic from a perl script check the version of the vMA or CLI that the script is running on?
Hello.
The command cat /etc/release* will get you the version and build number.
Good Luck!
Thanks Brian,
This works nicely for the vMa and maybe the CLI on Linux, but I don't imagine the etc directory exist on Windows... I'll go poke at it though. Thanks for a starting point.
First off, vMA is a RHEL appliance, so this will only apply if you're checking vMA and not for Windows/etc.:
[vi-admin@scofield ~]$ cat /etc/vima-release vMA 4.0.0 BUILD-161992 Copyright (C) 1998-2009 VMware, Inc. All rights reserved. Protected by one or more U.S. Patent Nos. 6,075,938, 6,397,242, 6,496,847, 6,704,925, 6,711,672, 6,725,289, 6,735,601, 6,785,886, 6,789,156, 6,795,966, 6,880,022, 6,944,699, 6,961,806, 6,961,941, 7,069,413, 7,082,598, 7,089,377, 7,111,086, 7,111,145, 7,117,481, 7,149,843, 7,155,558, 7,222,221, 7,260,815, 7,260,820, 7,269,683, 7,275,136, 7,277,998, 7,277,999, 7,278,030, 7,281,102, 7,290,253, 7,356,679, 7,409,487, 7,412,492, 7,412,702, 7,424,710, 7,428,636, 7,433,951, 7,434,002, 7,447,854, 7,475,002, 7,478,173, 7,478,180, 7,478,218, 7,478,388, 7,484,208, 7,487,313, 7,487,314, and 7,490,216; patents pending. VMware, the VMware "boxes" logo and design, Virtual SMP and VMotion are registered trademarks or trademarks of VMware, Inc. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks of their respective companies.
If you're using the VMware's default runtime Perl modules, this is automatically built in to get the version of the vSphere SDK for Perl such as (works for Windows/Linux):
[vi-admin@scofield ~]$ ./vmwarevSphereHealthCheck.pl --version VI Perl Toolkit version: 4.0 Script 'vmwarevSphereHealthCheck.pl' version: 1.5.0
You can however control the version of your script by setting:
$Util::script_version = "1.0"
There's only two version of vMA and per VMware the official release is vMA 4.0 which covers support for both VI 3.5 and vSphere 4.0, so you may just want to check for that version or greater.
=========================================================================
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".