From: Amir on
Hello there,

I need to create a vbs script that will do the following:

Will check if certain application is installed, by checking if the following
key is exists:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\visio
viewer_v2003

If exist, the scripts ends.
If not exist, will install an application from a network share:
\\servername\sharename\setup.exe

Any help will be appreciated.

Thank you
Amir :)

From: Pegasus [MVP] on


"Amir" <Amir(a)discussions.microsoft.com> wrote in message
news:BE109F90-96B8-4E17-937A-45672F638395(a)microsoft.com...
> Hello there,
>
> I need to create a vbs script that will do the following:
>
> Will check if certain application is installed, by checking if the
> following
> key is exists:
>
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\visio
> viewer_v2003
>
> If exist, the scripts ends.
> If not exist, will install an application from a network share:
> \\servername\sharename\setup.exe
>
> Any help will be appreciated.
>
> Thank you
> Amir :)
>

Here you go - straight from the Scripting Guy's pages:

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
strValueName = "Test Value"
objRegistry.GetStringValue
HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

If IsNull(strValue) Then
Wscript.Echo "The registry key does not exist."
Else
Wscript.Echo "The registry key exists."
End If