I'm trying to detect .NET Extended via registry GUID and once detected, I would like the installation to ignore dotNetFx40_Full_x86_x64.exe installation and continue the install of BrainStorm but if not detected, I would like dotNetFx40_Full_x86_x64.exe to install as a dependecy for BrainStorm. See script below. It works but it installs dotNetFx40_Full_x86_x64.exe on every install. Thanks for all your help.
__
<#
.SYNOPSIS
.LINK
Param (
$appName = "Quick Help X86"
$appVersion = "3.02"
$appArch = ""
$appLang = "EN"
$appRevision = "01"
$appScriptVersion = "1.0.0"
$appScriptDate = "01/08/2014"
$appScriptAuthor = "Carlito Castillo"
$deployAppScriptVersion = "3.0.0"
$deployAppScriptDate = "08/21/2013"
$deployAppScriptParameters = $psBoundParameters
Exit-Script -ExitCode 0 # Otherwise call the Exit-Script function to perform final cleanup operations
__
<#
.SYNOPSIS
This script performs the installation or uninstallation of an application(s).
.DESCRIPTIONThe script is provided as a template to perform an install or uninstall of an application(s).
The script either performs an "Install" deployment type or an "Uninstall" deployment type.
The install deployment type is broken down in to 3 main sections/phases: Pre-Install, Install, and Post-Install.
The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
To access the help section,
.EXAMPLEDeploy-Application.ps1
.EXAMPLEDeploy-Application.ps1 -DeploymentType "Silent"
.EXAMPLEDeploy-Application.ps1 -AllowSCCMReboot -AllowDefer
.EXAMPLEDeploy-Application.ps1 -Uninstall
.PARAMETER DeploymentTypeThe type of deployment to perform. [Default is "Install"]
.PARAMETER DeployModeSpecifies whether the installation should be run in Interactive, Silent or NonInteractive mode.
Interactive = Default mode
Silent = No dialogs
NonInteractive = Very silent, i.e. no blocking apps. Noninteractive mode is automatically set if an SCCM task sequence or session 0 is detected.
.PARAMETER AllowRebootPassThruAllows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation.
If 3010 is passed back to SCCM a reboot prompt will be triggered.
.NOTES.LINK
Http://psappdeploytoolkit.codeplex.com
"#>Param (
[ValidateSet("Install","Uninstall")]
[string]$DeploymentType = "Install",
[ValidateSet("Interactive","Silent","NonInteractive")]
[string]$DeployMode = "Interactive",
[switch]$AllowRebootPassThru = $false
)*===============================================
* VARIABLE DECLARATION
Try {*===============================================
*===============================================
Variables: Application
$appVendor = "BrainStorm"$appName = "Quick Help X86"
$appVersion = "3.02"
$appArch = ""
$appLang = "EN"
$appRevision = "01"
$appScriptVersion = "1.0.0"
$appScriptDate = "01/08/2014"
$appScriptAuthor = "Carlito Castillo"
*===============================================
Variables: Script - Do not modify this section
$deployAppScriptFriendlyName = "Deploy Application"$deployAppScriptVersion = "3.0.0"
$deployAppScriptDate = "08/21/2013"
$deployAppScriptParameters = $psBoundParameters
Variables: Environment
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.DefinitionDot source the App Deploy Toolkit Functions
."$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"*===============================================
* END VARIABLE DECLARATION
*===============================================
*===============================================
* PRE-INSTALLATION
If ($deploymentType -ne "uninstall") { $installPhase = "Pre-Installation"*===============================================
# Show Welcome Message, close applications if required, allow up to 3 deferrals
Show-InstallationWelcome -CloseApps "iexplore,excel,groove,onenote,infopath,onenote,outlook,mspub,powerpnt,winword,winproj,visio" -AllowDefer -DeferTimes 3
# Show Progress Message (with the default message)
# Scans for .NET Extended Installation
Get-RegistryKey "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{8E34682C-8118-31F1-BC4C-98CD9675E1C2}" -ContinueOnError
# Show Installation in Progress
Show-InstallationProgress "BrainStorm 3.02 Installation in Progress..." -WindowLocation "BottomRight" -TopMost $false
# Remove any previous versions of BrainStorm
Remove-MSIApplications "BrainStorm"
*===============================================
* INSTALLATION
$installPhase = "Installation"*===============================================
# Install the base EXE
Execute-Process -FilePath "dotNetFx40_Full_x86_x64.exe" -Arguments "/q /norestart"
# Install the base MSI and apply a transform
Execute-MSI -Action Install -Path "BrainStormQuickHelpX86.msi" -Transform "Brainstorm_Training_3.0.mst" -Parameters "DESKTOPICON=0 LOGINMETHOD=SSO COMPANYNAME=test.com /QN"
*===============================================
* POST-INSTALLATION
$installPhase = "Post-Installation"*===============================================
*===============================================
* UNINSTALLATION
} ElseIf ($deploymentType -eq "uninstall") { $installPhase = "Uninstallation"*===============================================
# Show Welcome Message, close applications if required with a 60 second countdown before automatically closing
Show-InstallationWelcome -CloseApps "iexplore,excel,groove,onenote,infopath,onenote,outlook,mspub,powerpnt,winword,winproj,visio" -AllowDefer -DeferTimes 3
# Show Progress Message (with a message to indicate the application is being uninstalled)
Show-InstallationProgress -StatusMessage "Uninstalling Application $installTitle. Please Wait..."
# Remove this version of BrainStorm
Execute-MSI -Action Uninstall -Path "{FF149C50-78D4-4897-A125-DF9F466A0777}"
*===============================================
* END SCRIPT BODY
} } Catch {$exceptionMessage = "$($_.Exception.Message)($($_.ScriptStackTrace)
)"; Write-Log "$exceptionMessage"; Show-DialogBox -Text $exceptionMessage -Icon "Stop"; Exit-Script -ExitCode 1} # Catch any errors in this script Exit-Script -ExitCode 0 # Otherwise call the Exit-Script function to perform final cleanup operations