Windows Vista Forums

vbs with conditions

  1. #1


    Amir Guest

    vbs with conditions

    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


      My System SpecsSystem Spec

  2. #2


    Pegasus [MVP] Guest

    Re: vbs with conditions



    "Amir" <Amir@newsgroup> wrote in message
    news:BE109F90-96B8-4E17-937A-45672F638395@newsgroup

    > 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


      My System SpecsSystem Spec

vbs with conditions

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using time conditions in vbs? D.P. Roberts VB Script 7 18 Dec 2008
Multiple IF Conditions preet VB Script 5 05 Jul 2008
Accept terms & conditions message for Excel worksheets MeasureMe Vista General 6 28 Mar 2007
Bindings to online: how to change them with network conditions Craig Kelly Avalon 0 06 Mar 2007