‘following is some scripts I made to read the registry, get the information of Flash player version, (start from there you can put like JRE version or what else in to get the requred information. For me at the moment Flash Player and JRE are very important for my school to get kids on internet and use some educational Flash or Javascripts. So I have to make this to gather information like which workstation has no requried software and fix them.

The other part not mentioned here is a web page to load database. I created a asp.net(VB) webpage to read the whole table into a datagrid, because it is gonna be too long to cover all of them here, I should discuss that part later. However, if you take sometime to learn how to use visual studio web designer/datagrid/data control/ datagrid template, it will be really easy to make. I spend 1/2 day to learn those and it take me 5 minutes to make a webpage show all the data with most userful search/sorting functions, and it is not really ugly.

there are reference if you google how to use vbs to read registry or link to sql database. The key is a combination. The osversion is important because in 64 bit OS, the registry of some applications are not always in same area of 32bit. it take me a while to compare the registry change and find it out. and if you read the vbs code you will learn the difference. Cheers.

dim osversion,versionvalue,flashexist
 On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
const HKEY_LOCAL_MACHINE = &H80000002

Set objWMIService = GetObject(“winmgmts:\\.\root\CIMV2″)
Set colItems = objWMIService.ExecQuery(“SELECT * FROM Win32_Processor”, “WQL”, _
                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
osversion= objItem.AddressWidth
strComputer = “.”
Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” &_
strComputer & “\root\default:StdRegProv”)

‘from here you can see, 32bit and 64bit has different registry location.

Set WshShell = WScript.CreateObject(“WScript.Shell”)if osversion=”32″ then
strKeyPath = “SOFTWARE\Macromedia\FlashPlayerActiveX”
 else
strKeyPath = “SOFTWARE\Wow6432Node\Macromedia\FlashPlayerActiveX”
end if
strValueName = “Version”

‘I spend sometime here to find out Flash_Version is a binary string,

‘ the method to read binary string is different from others, if you use wrong ‘method to read registry, most likely you get blank. Be careful.

oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,Flash_Version
 wscript.echo  “Current flash player version is : ” & Flash_Version

‘we had Flash_version, now just need insert/update it into the table.

Dim sServer,sLogin,sPwd,oCn,oRs,Wl,sql
 
sServer = “<servername>”
sLogin = “<Username>”
sPwd = “<password>”

Set oCn = CreateObject( “ADODB.Connection” )
Set oRs = CreateObject( “ADODB.Recordset”  )

oCn.ConnectionString = “PROVIDER=SQLOLEDB” & _
                       “;SERVER=” & sServer   & _
                       “;UID=”    & sLogin  & _
                       “;PWD=”    & sPwd    & _
                       “;DATABASE=bsc”
oCn.open
sql= “Select Host_Name from <tableName> where Host_Name = ‘”& WshShell.expandenvironmentstrings(“%COMPUTERNAME%”) & “‘”
oRs.Open sql, oCn
If Not oRs.EOF then
‘ see shall we use insert or use update.
 ors.close
 
  strQuery = “update <tableName> set flash_player=’”&Flash_Version&”‘ where host_name=’”& WshShell.expandenvironmentstrings(“%COMPUTERNAME%”)& “‘”
  else
 strQuery = “INSERT INTO  bscpcs (flash_player, Host_Name) VALUES (‘”&Flash_Version&”‘, ‘”& WshShell.expandenvironmentstrings(“%COMPUTERNAME%”)& “‘)”
end If
msgbox strQuery
oCn.Execute(strQuery)
 
oCn.Close
next

 

About Lei

I am an IT specialist with over 10 year experience - years on Automation, on-Premise or Azure.

I am happy to develop however never want be a full time developer. Only do what I have to do. If it has to be PowerShell,HTML, PHP, CSS, C#, VBS or JS, front end or backend, so be it, doesn't matter!

Spent years with Windows, SCCM, SharePoint, SQL and Exchange servers. For last several years, I have been actively working under On Premise > Azure environment.

THERE IS NO WAY BACK!!!

Current Certificates:
    Microsoft® Certified-
  • -Enterprise Administrator
  • -Database Administrator
  • -SharePoint Administrator
  • -Administering and Deploying SCCM 2012
Red Hat Certified Technician
ITIL V3 Foundation - Practitioner

Working on Azure Certificates now and hopefully they can stop upgrading their questions one day! GIVE ME A BREAK!

Contact Lei

Name *
Email *
Comments *

Traffic since 10/08/2016

Today13
Yesterday83
This week637
This month1933
Total416293

Visitor Info

  • IP: 54.221.73.186
  • Browser: Unknown
  • Browser Version:
  • Operating System: Unknown

Who Is Online

1
Online

2017-12-17

Login