Thanks,
Jeff
Hi
You can do it with e.g. some registry reads:
--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Select Case WshShell.RegRead("HKCR\.mdb\")
Case "Access.Application.8"
Msgbox "Access 97"
Case "Access.Application.9"
Msgbox "Access 2000"
Case "Access.Application.10"
Msgbox "Access XP"
Case "Access.Application.11"
Msgbox "Access 2003"
Case Else
Msgbox "Access not installed"
End Select
Set WshShell = Nothing
--
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft MVP [Windows NT/2000 Operating Systems]
Thanks,
Jeff
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:3FBA8F4A...@hydro.com...
> Thanks, Torgeir. That helps. One follow up question: Will the script in
> the posting belo work for remote computers? I'd like to be able to run the
> script against the PCs at our site.
Hi
No, not like the way it is now, the Regreads needs to be changed to use WMI's Standard Registry Provider (see
below).
One issue with WMI is that if the remote computer is offline by some reason, the timeout for the WMI connection
is pretty long.
If you run your script from a WinXP computer, I think there is a way to set the
timeout for the WMI connection. If you run this from a Win2k (or WinXP)
computer, you could ping the computer before you connect to it to see if it is
online.
The VBScript function IsConnectible in the link below will work on all OS
versions (it uses ping.exe to ping the host to see if it is online):
http://groups.google.com/groups?selm=3EB2AA54.EBB5ECBC%40hydro.com
Here is a suggestion for a WMI version of the GetOfficeVer function:
sComputer = "some ip or computer name here" ' use "." for local computer
iOfficeVer = GetOfficeVer(sComputer)
If iOfficeVer = -1 Then
WScript.Echo "Version of Office installed is unknown, " _
& "could not connect to the remote computer."
Elseif iOfficeVer = 0 Then
WScript.Echo "Office is not installed."
Else
WScript.Echo "Version of Office installed: " & iOfficeVer
End If
Function GetOfficeVer(sNode)
On Error Resume Next
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& sNode & "/root/default:StdRegProv")
If Err.Number <> 0 Then
GetOfficeVer = -1
Exit Function '------->
End If
sValueName = "Path"
sRegPre = "SOFTWARE\Microsoft\Office\"
sRegPost = "\Common\InstallRoot"
If oReg.GetStringValue( _
HKLM, sRegPre & "11.0" & sRegPost, sValueName, sValue) = 0 Then
GetOfficeVer = 2003
Elseif oReg.GetStringValue( _
HKLM, sRegPre & "10.0" & sRegPost, sValueName, sValue) = 0 Then
GetOfficeVer = 2002
Elseif oReg.GetStringValue( _
HKLM, sRegPre & "9.0" & sRegPost, sValueName, sValue) = 0 Then
GetOfficeVer = 2000
Elseif oReg.GetStringValue( _
HKLM, sRegPre & "8.0" & sRegPost, sValueName, sValue) = 0 Then
GetOfficeVer = 97
Else
GetOfficeVer = 0
End If
End Function