Jump to content

Recommended Posts

We have some in-house applications that need the .Net framework to run, but nobody around here wants to install it if they don't already have it. I wrote this little setup bootstrap to detect whether the framework was installed, and if not, to install it silently from a location where it is already downloaded.

$HasNet10=(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\Policy\v1.0", "3705")="3321-3705")
$HasNet11=(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\Policy\v1.1", "4322")="3706-4322")
$HasNet20=(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\Policy\v2.0", "50727")="50727-50727")
$Proc = StringUpper(@ProcessorArch); just to be sure it will be recognized

ConsoleWrite("Microsoft .Net Version 1.0 Installed? " & $HasNet10 & @cr)
ConsoleWrite("Microsoft .Net Version 1.1 Installed? " & $HasNet11 & @cr)
ConsoleWrite("Microsoft .Net Version 2.0 Installed? " & $HasNet20 & @cr)
Consolewrite("Processor Architecture: " & $Proc & @cr)

;~ Based on http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;315291
;~ For a full list of command-line switches for the .Net installer, see:
;~  http://blogs.msdn.com/astebner/archive/2005/11/07/490167.aspx (1.0, 1.1)
;~  http://blogs.msdn.com/astebner/archive/2005/11/07/490167.aspx (2.0)
If $HasNet20=False then
    if $Proc="X86" then 
        RunWait(@ScriptDir & "\dotnet20\X86\dotnetfx.exe /q")
    elseif $Proc = "X64" Then
        RunWait(@ScriptDir & "\dotnet20\X64\netfx64.exe /q")
    ElseIf $Proc = "IA64" Then
        RunWait(@ScriptDir & "\dotnet20\IA64\netfx64.exe /q")
    Else
        $msg = "The Microsoft .Net Framework 2.0 is not installed, and your system archetecture is not recognized. "
        $msg = $msg & "The program will take now you to the Microsoft site where you may download the correct package manually."
        MsgBox(0,"Installer", $msg )
        RunWait("http://msdn.microsoft.com/netframework/downloads/updates/default.aspx")
    EndIf
EndIf

Run("MyProgram.exe")
Link to post
Share on other sites
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...