I have a script (below) that finds the current version of Microsoft Office Installed and outputs it as a string. The string output for example would be 15.0.4771.1000. I don't care about anything past the 15. My goal is to verify that the version of Office is 15. I want to take the substring of the digts before the 1st . (period) and compare it to the value in questioned. How would I do this?
The script below doesn't work even with a wild card for the compared value.
Dim oRegistry
Dim oFSO
Dim sKey
Dim sAppExe
Dim sValue
Dim sAppVersion
Const HKEY_LOCAL_MACHINE = &H80000002
Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//./root/default:StdRegProv")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sKey = "Software\Microsoft\Windows\CurrentVersion\App Paths"
oRegistry.GetStringValue HKEY_LOCAL_MACHINE, sKey & "\" & sAppExe, "", sValue
MsgBox oFSO.GetFileVersion(sValue)
If oFSO.GetFileVersion(sValue)="15.*" Then
WScript.Echo("Office 2013 is installed")
Else
WScript.Echo("You do not have Office 2013 installed")
End If
Set oFSO = Nothing
Set oRegistry = Nothing
SplitFunction