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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to find out what version of office prople have 1

Status
Not open for further replies.

timgerr

IS-IT--Management
Jan 22, 2004
364
US
With this new MS vulnerability that is out MS04-028, I need to create a script that will remotely find out what version and service pact of office people are running. I was wondering if anyone has one.

Thanks,
Timgerr

-How important does a person have to be before they are considered assissinated instead of just murdered?

 
the base anal will do the trick, if not this will list all MSI based installations,,,i think

Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Dim oReg, arrSubKeys, subKey, strDisplayName, strDisplayVersion, blnOffice2000, blnOffice2003, strOfficeV
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
".\root\default:StdRegProv")
oReg.EnumKey HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys
blnOffice2000 = "false"
blnOffice2003 = "false"
strOfficeV = ""

For Each subKey In arrSubKeys
strDisplayName = ""
strDisplayVersion = ""
'On Error Resume Next
strDisplayName = LCase(WshShell.RegRead("HKEY_LOCAL_MACHINE\" & UnInstPath & subKey & "\DisplayName"))
strDisplayVersion = LCase(WshShell.RegRead("HKEY_LOCAL_MACHINE\" & UnInstPath & subKey & "\DisplayVersion"))
'On Error Goto 0
objTS.WriteLine Now() & vbTab & subKey & ";" & strDisplayName & ";" & strDisplayVersion
'check for Microsoft & Office & 2000
If Instr(strDisplayName, "microsoft") And Instr(strDisplayName, "office") And Instr(strDisplayName, "2000") Then
blnOffice2000 = "true"
End If
If Instr(strDisplayName, "microsoft") And Instr(strDisplayName, "office") And Instr(strDisplayName, "2003") Then
blnOffice2003 = "true"
End If
Next
'check office version
If blnOffice2000 = "true" Then
If blnOffice2003 = "true" Then
strOfficeV = "2003"
Else
strOfficeV = "2000"
End If
Else
If blnOffice2003 = "true" Then
strOfficeV = "2003"
Else
strOfficeV = "unknown"
End If
End If
objTS.WriteLine Now() & vbTab & strOfficeV & " = Office location
 
Thank you all for the help.

Tim

-How important does a person have to be before they are considered assissinated instead of just murdered?

 
OK here is what I did, It might not look pretty but it works for me:
Code:
On Error Resume Next 
Function sVersion(sLocation, sPath, sWinWord)

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & sLocation & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
    ("SELECT * FROM CIM_Datafile WHERE Name = '" & sPath & sWinWord & "'")
For Each objFile in colFiles
	If objFile.Version = "9.0.0.6926" Then 
		WScript.Echo "OFF2000 SP3" 
	End If 
	If objFile.Version = "10.0.4219.0" Then 
		WScript.Echo "OFFXP SP2" 
	End If 
	If objFile.Version = "9.0.0.8216" Then 
		WScript.Echo "OFF2000" 
	End If 
	If objFile.Version = "10.0.5815.0" Then 
		WScript.Echo "OFFXP" 
	End If 	
	If objFile.Version = "10.0.6612" Then 
		WScript.Echo "OFFXP SP3" 
	End If 
	
    Wscript.Echo "Version: " & objFile.Version
Next
End Function 

Dim sLocation
Dim sPath(1)
Dim sWinWord
sLocation 	= InputBox("Please enter a computer name")
sWinWord 	= "\\winword.exe"
sPath(0)	= "C:\\Program Files\\Microsoft Office XP\\OFFICE11"
sPath(1)	= "C:\\Program Files\\Microsoft Office XP\\OFFICE10"
I = 0 
Do Until  I = 2
	sVersion sLocation, sPath(I), sWinWord
	
	I = I + 1
Loop


sVersion sLocation, sPath, sWinWord

-How important does a person have to be before they are considered assissinated instead of just murdered?

 
The above script will allow me to connect to users remotly and get the information.

-How important does a person have to be before they are considered assissinated instead of just murdered?

 
timegerr,

Thanks for sharing. It's real good.

- tsuji
 
To speed up the major version number search you may inspect this key value:
HKEY_CLASSES_ROOT\Word.Application\CurVer

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top