if Variable NET2SP2 Equals FALSE
  Set Variable PROGRESSTEXT to Installing Microsoft .NET Framework 2.0 Service Pack 2
  Get System Setting Windows 8 into NET2SP2_IS8
  if Variable NET2SP2_IS8 Equals TRUE
    Set Variable PROGRESSMODE to MARQUEE
    Run Program dism.exe /online /Enable-Feature /all /FeatureName:NetFx3 (WAIT, get result into variable NET2SP2_RESULT)
    Set Variable PROGRESSMODE to 
  else
    Set Variable NET2SP2_FILEBAG to 
    Set Variable NET2SP2_RESULT to 
    Set Variable NET2SP2_ERROR to 
    Get Common Folder Location Special->Boot Path into NET2SP2_BOOTPATH
    Define File Bag : #IADIR#\runtimes\NET2SP2bin.7zip, include files recursively, get runtime location of files into variable NET2SP2_FILEBAG
    Extract 7Zip Archive $NET2SP2_FILEBAG$\net2sp2bin.7zip into folder $NET2SP2_BOOTPATH$ (get result into variable NET2SP2_EXTRACT)
    if Variable NET2SP2_EXTRACT not Equals SUCCESS
      MessageBox: $TITLE$ Setup, Unable to extract temporary files for Microsoft .NET Framework 2.0 Service Pack 2 installation. $NET2SP2_EXTRACT$$NEWLINE$$NEWLINE$Please free up some space on your boot drive and try again.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
      Terminate Installation
    end
    if Variable NET2SP2_ISVISTA Equals TRUE
      Set Variable PROGRESSMODE to MARQUEE
      Run Program wusa.exe "$NET2SP2_BOOTPATH$\net2sp2bin\Vista\NetFX2.0-KB948609-v6001-x86.msu" /quiet /norestart (WAIT, get result into variable NET2SP2_RESULT)
      Set Variable PROGRESSMODE to 
      if Variable NET2SP2_RESULT not Equals 0
        if Variable NET2SP2_RESULT not Equals 3010
          Check File Version $NET2SP2_WINDIR$\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll into Variable NET2SP2_FILE
          if Variable NET2SP2_FILE Equals TRUE
            Set Variable NET2SP2_RESULT to 0
          end
        end
      end
    else
      Install/Remove MSI Package $NET2SP2_BOOTPATH$\net2sp2bin\Netfx20a_x86.msi[VSEXTUI=1] (get result into variable NET2SP2_RESULT)
    end
    Recursively Delete Files $NET2SP2_BOOTPATH$\net2sp2bin\*.*
    Call DLL Function kernel32.dll->RemoveDirectoryA
  end
  if Variable NET2SP2_ISVISTA Equals TRUE
    if Variable NET2SP2_RESULT not Equals 0
      if Variable NET2SP2_RESULT Equals 3010
        MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
        if Variable REBOOTNOW Equals OK
          Reboot Computer and Resume Setup
        else
          Terminate Installation
        end
      else
        MessageBox: $TITLE$ Setup, Microsoft .NET Framework 2.0 Service Pack 2 could not be installed. Please use Windows Update to manually install this update on your system.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
        Terminate Installation
      end
    end
  else
    if Variable NET2SP2_RESULT Equals REBOOT
      MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
      if Variable REBOOTNOW Equals OK
        Reboot Computer and Resume Setup
      else
        Terminate Installation
      end
    end
    if Variable NET2SP2_RESULT Equals ERROR
      MessageBox: $TITLE$ Setup, Microsoft .NET Framework 2.0 Service Pack 2 could not be installed.  $NET2SP2_ERROR$$NEWLINE$$NEWLINE$Please use Windows Update to manually install this update on your system.$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
      Terminate Installation
    end
  end
end
 
