Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding Flash Version via VBS

Status
Not open for further replies.
Joined
Jul 24, 2007
Messages
9
Location
US
I am familiar with the FSO aspect of VB scripting, but I have been asked to generate a text based report on what version of the flash plugin all the computers in our domain are running. Does anyone know what the Active X controls stings are or maybe have a sample script?

Thanks

Jake
 
I have no idea about VB, but with JavaScript you would detect ActiveX version like this from client browser:
Code:
function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}
(Code by Macromedia)

Kenneth Kawamoto
 
Thanks, I finally decided to just write out the registry value for the machine to a file. Here is the code:


'Author: Jake Linebaugh

Const ForAppending = 8
Const HKEY_LOCAL_MACHINE = &H80000002

Set objNet = CreateObject("WScript.Network")
Set objComputer = CreateObject("Shell.LocalMachine")

strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Macromedia\FlashPlayer"
strValueName = "CurrentVersion"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue


If strValue > 0 Then

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("\\server\share\file.txt", ForAppending, True)

objTextFile.WriteLine objNet.UserName & vbtab & objComputer.MachineName & vbtab & "Current Flash Version: " & vbtab & strValue

Else

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("\\server\share\file.txt", ForAppending, True)

objTextFile.WriteLine objNet.UserName & vbtab & objComputer.MachineName & vbtab & "No flash detected in registry"

End If

objTextFile.Close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top