Deployment Solution

 View Only
Expand all | Collapse all

how do i check to see if .NET 3.5 is installed before continuing with install job

  • 1.  how do i check to see if .NET 3.5 is installed before continuing with install job

    Posted Feb 10, 2010 11:04 PM
    hey all

    i have a program that we need to roll out at work which requires .NET 3.5

    i have no problems creating the install job so that it installs .Net 3.5 and then installs the application.
    what id like to know is how can i setup my job so that it checks to see if .NET 3.5 is already installed...and if it is, it skips the .NET install and goes straight to the application install.


    im assuming i need to create some sort of script that looks at the pc's application list, but ive got no idea on how this is done as im fairly new to altiris and scripting.


    the install package runs from a server location
    the .NET file is called dotnetfx35.exe
    with the following 2 switches /qb /norestart


    on a test pc i can clearly see in the computer properties -> application that

    Microsoft .NET framework 3.5

    is installed.


    so...

    how do i put this into a script so it checks for that, and if it exists...it skips it.


    many thanks for your help


    maZu














  • 2.  RE: how do i check to see if .NET 3.5 is installed before continuing with install job

    Posted Feb 10, 2010 11:36 PM

    If you need help with the script here is a very basic vbscript sample here which will check for a registry value then set a boolean if .net framework 3.5 is installed, if it is installed it will run the app only.

    If .net framework isn't installed it will launch the .net install then the app after waiting for the 1st install to finish:

    NOTE : this script hasn't been tested :-)

    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Const HKEY_LOCAL_MACHINE = &H80000002

    net35Installed = False

    set oShell = CreateObject("Shell.Application")
    Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")

    strKeyPath = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7131646D-CD3C-40F4-97B9-CD9E4E6262EF}"   ' change this GUID to suit
    strValueName = "DisplayName"   ' this value should always exist
    objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

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

    If net35Installed = False Then
       oShell.Run "dotnetfx35.exe /qb /norestart", 1, True
       oShell.Run "myapplication.exe /blah", 1, True
    Else
       oShell.Run "myapplication.exe /blah", 1, True
    End If


    '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    otherwise you could setup two jobs:

    1. check if .net framework 3.5 is installed, if not then install .net framework...

    once that has run on all machines....

    2. install your app  (would still pay to check that .net framework is installed in case your first job missed or failed on any machines.

     



  • 3.  RE: how do i check to see if .NET 3.5 is installed before continuing with install job

    Posted Feb 10, 2010 11:40 PM
    far out, id never have worked that out :P

    thanks for the script, ill give it a go and adjust it accordingly and give it a try...

    im sure ill run into problems doing this so ill post back and let you know :P

    thanks again!

    maZu


  • 4.  RE: how do i check to see if .NET 3.5 is installed before continuing with install job

    Posted Feb 10, 2010 11:54 PM
    no worries - post back and let me know how it goes either way

    also remember to 'thumbs up' if you found it helpful :-)


  • 5.  RE: how do i check to see if .NET 3.5 is installed before continuing with install job

    Posted Feb 10, 2010 11:57 PM
    This is a little simpler of an approach.

    To check for .NET 3.5 and, if it is installed, run setup.exe, and if it's not, run dotnetfx35.exe followed by setup.exe, run this script

    @echo off
    IF EXIST %windir%\microsoft.net\framework\v3.5 (
    echo Installing Your Program..
    yourprogram.exe /qb norestart
    ) Else (
    echo Installing Microsoft .NET 3.5..
    dotnetfx35.exe /qb /norestart
    echo Installing Your Program..
    yourprogram.exe /qb norestart
    )


    As you can see, this checks the Windows directory for the correct Framework folder.  If it finds it, it runs the program you want to install without first reinstalling .NET 3.5.  If it doesn't find it, it installs .NET 3.5 and then installs your program.  Of course, as you said, this is running from a network drive, so you'll want to replace my "yourprogram.exe" and "dotnetfx35.exe" with your full paths.


  • 6.  RE: how do i check to see if .NET 3.5 is installed before continuing with install job

    Posted Feb 11, 2010 12:21 AM
    that looks a lot easier, so ive tried that and made the changes to what we have here..
    and this is what i have


    REM Install PDFDocs FormFiller

    @echo off

    IF EXIST %windir%\microsoft.net\framework\v3.5 (
    "\\bmausnt510\SYDDFS\APPLICATIONS\DocsCorp\PDFDocsFormFiller\DocsCorp_pdfDocs_formFiller_2-0-1-3.msi" /qn
    )
    Else (
    "\\bmausnt510\SYDDFS\APPLICATIONS\Microsoft\DotNet\DotNet3.5\dotnetfx35.exe" /qb /norestart
    "\\bmausnt510\SYDDFS\APPLICATIONS\DocsCorp\PDFDocsFormFiller\DocsCorp_pdfDocs_formFiller_2-0-1-3.msi" /qn
    )



    this partially worked
    it did install the application, but it then said that ELSE is not a supported command and then started installing dotnetfx35

    any ideas ?

    maybe im wrong but shouldnt i put a END IF somewhere?





  • 7.  RE: how do i check to see if .NET 3.5 is installed before continuing with install job

    Posted Feb 11, 2010 12:30 AM
    oh i think i fixed it

    i fixed the coding up so the ELSE is between the 2 brackets

    so now its


    ) Else (


    and i just tested it and its worked!
    wooo

    ok now to test to see if it will install 3.5 then the app


    will post back...



  • 8.  RE: how do i check to see if .NET 3.5 is installed before continuing with install job

    Posted Feb 11, 2010 12:37 AM
    Hi,

    In your script I would check for the existence of the .NET Framework 3.5 'uninstall' registry key, I don't have .net 3.5 on my machine now but it will be under:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

    e.g. for .net framework 2.0 the key to check for will be:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7131646D-CD3C-40F4-97B9-CD9E4E6262EF}

    If the .net 3.5 key exists then skip the installation and install your application

    Cheers





  • 9.  RE: how do i check to see if .NET 3.5 is installed before continuing with install job

    Posted Feb 11, 2010 12:52 AM
    well that seems to have worked as well

    that was easier then i thought...but i still wouldnt have been able to create even the simple script :P

    thanks for all your help :)


    maZu




  • 10.  RE: how do i check to see if .NET 3.5 is installed before continuing with install job

    Posted Feb 26, 2010 04:44 AM
    Just be aware that you have no error checking going on there, if the .Net3.5 install fails it will still try to install your application.

    You could do a job with 2 conditions, one that checks for the presence of application "Microsoft .NET Framework 3.5" and only installs your application, and a default one that installs .Net3.5 then installs your application. These can then use the "Distribute Software" task and stop on errors.