Thank you Dan,
That's very useful!
However, now I'm having an issue where the script will not run at all and I receive no error notifications. Perhaps you wouldn't mind helping me out, here is exactly what I have.
That's very useful!
However, now I'm having an issue where the script will not run at all and I receive no error notifications. Perhaps you wouldn't mind helping me out, here is exactly what I have.
#*===============================================
#* VARIABLE DECLARATION
Try {
#*===============================================
#*===============================================
# Variables: Application
$appVendor = "Lenovo"
$appName = "System Update"
$appVersion = "5.05.0008"
$appArch = ""
$appLang = "EN"
$appRevision = "01"
$appScriptVersion = "1.0.0"
$appScriptDate = "04/15/2014"
$appScriptAuthor = ""
#*===============================================
# Variables: Script - Do not modify this section
$deployAppScriptFriendlyName = "Deploy Application"
$deployAppScriptVersion = [version]"3.1.0"
$deployAppScriptDate = "02/25/2013"
$deployAppScriptParameters = $psBoundParameters
# Variables: Environment
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Definition
# Dot 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 Internet Explorer if required, allow up to 3 deferrals, verify there is enough disk space to complete the install and persist the prompt
Show-InstallationWelcome -CloseApps "iexplore" -AllowDefer -DeferTimes 3 -CheckDiskSpace -PersistPrompt -MinimizeWindows 0
# Show Progress Message (with the default message)
Show-InstallationProgress
# Perform pre-installation tasks here
#*===============================================
#* INSTALLATION
$installPhase = "Installation"
#*===============================================
# Perform installation tasks here
#*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Custom Variables
# Get the OS version
$osVersion = [version]$($envOS.version)
# Get the .NetFx 3.5 status
$netFX = (Get-WindowsOptionalFeature -Online -FeatureName NetFx3).State
# Establishing the Lenovo System Update Version variable
$suVersion = (Get-ItemProperty "HKLM:\Software\Wow6432Node\Lenovo\System Update" -Name Version).Version
#*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Check if OS version is Windows 8 or greater
If (($osVersion -ge 6.2)-and($suVersion -lt $"$appVersion")) {
# Check is .Net Framework Feature is Enabled for System Update Pre-Req, if not then Enable then install System Update or Install if already Enabled.
If ($netFX -eq "Disabled"){
Write-Log ".Net Framework 3.5 Not Enabled - Installing Feature."
Show-InstallationProgress "Installing .Net Framework 3.5 Pre-Requisite"
Enable-WindowsOptionalFeature –Online –FeatureName NetFx3 –All -LimitAccess -Source $dirSupportFiles\sources\sxs
Write-Log "Installing Lenovo System update $appVersion"
Show-InstallationProgress "Installing Latest Lenovo System Update version $appVersion"
Execute-Process -FilePath "systemupdate505-02-14-2014.exe" -Arguments "-s -a /s /v/qn CREATESHORTCUT=1 REBOOT=R"}
# Enable .Net framework 3.5 Method #1 (Windows Update) Enable-WindowsOptionalFeature –Online –FeatureName NetFx3 –All
# Enable .Net framework 3.5 Method #2 (Source Dir) Enable-WindowsOptionalFeature –Online –FeatureName NetFx3 –All -LimitAccess -Source $dirSupportFiles\sources\sxs
# If .Net framework 3.5 Enabled, and Lenovo System Update is below current installer version - Run Installer
elseif ($netFX -eq "Enabled"){
Write-Log "Installing Lenovo System update"
Show-InstallationProgress "Installing Latest Lenovo System Update version"
Execute-Process -FilePath "systemupdate505-02-14-2014.exe" -Arguments "-s -a /s /v/qn CREATESHORTCUT=1 REBOOT=R"}
}
# Check if OS version is less than Windows 8
elseif (($osVersion -lt 6.2)-and($suVersion -lt $"$appVersion")) {
Write-Log "Installing Lenovo System update $appVersion"
Show-InstallationProgress "Installing Latest Lenovo System Update version $appVersion"
Execute-Process -FilePath "systemupdate505-02-14-2014.exe" -Arguments "-s -a /s /v/qn CREATESHORTCUT=1 REBOOT=R"
}
#*===============================================
#* POST-INSTALLATION
$installPhase = "Post-Installation"
#*===============================================
# Perform post-installation tasks here
#If ($suVersion -lt $"$appVersion") {
Write-Log "Updating custom Registry entries"
Show-InstallationProgress "Updating Registry entries"
# UCSettings
Set-RegistryKey -Key "HKLM\SOFTWARE\Wow6432Node\Lenovo\System Update\Preferences\UCSettings\Billboard" -Name "LiveFeed" -Value "" -Type String
# User Settings
Set-RegistryKey -Key "HKLM\SOFTWARE\Wow6432Node\Lenovo\System Update\Preferences\UserSettings\General" -Name "DebugEnable" -Value "YES" -Type String
Set-RegistryKey -Key "HKLM\SOFTWARE\Wow6432Node\Lenovo\System Update\Preferences\UserSettings\General" -Name "DisplayInformationScreen" -Value "NO" -Type String
Set-RegistryKey -Key "HKLM\SOFTWARE\Wow6432Node\Lenovo\System Update\Preferences\UserSettings\General" -Name "DisplayLicenseNotice" -Value "NO" -Type String
Set-RegistryKey -Key "HKLM\SOFTWARE\Wow6432Node\Lenovo\System Update\Preferences\UserSettings\General" -Name "DisplayLicenseNoticeSU" -Value "NO" -Type String
Set-RegistryKey -Key "HKLM\SOFTWARE\Wow6432Node\Lenovo\System Update\Preferences\UserSettings\General" -Name "IgnoreLocalLicense" -Value "YES" -Type String
Set-RegistryKey -Key "HKLM\SOFTWARE\Wow6432Node\Lenovo\System Update\Preferences\UserSettings\General" -Name "IgnoreRMLicCRCSize" -Value "NO" -Type String
Set-RegistryKey -Key "HKLM\SOFTWARE\Wow6432Node\Lenovo\System Update\Preferences\UserSettings\Scheduler" -Name "SchedulerLock" -Value "HIDE" -Type String
Set-RegistryKey -Key "HKLM\SOFTWARE\Wow6432Node\Lenovo\System Update\Preferences\UserSettings\Scheduler" -Name "NotifyOptions" -Value "DOWNLOADANDINSTALL-INCLUDEREBOOT" -Type String
else
{
Show-DialogBox -Title "Version $appVersion Compliant" -Text "Your Lenovo System Update is already at the latest version."
}
#*===============================================
#* UNINSTALLATION
} ElseIf ($deploymentType -eq "uninstall") { $installPhase = "Uninstallation"
#*===============================================
# Show Welcome Message, close Internet Explorer if required with a 60 second countdown before automatically closing
Show-InstallationWelcome -CloseApps "iexplore" -CloseAppsCountdown "60"
# Show Progress Message (with the default message)
Show-InstallationProgress
# Perform uninstallation tasks here
Execute-MSI -Action Uninstall -Path "{25C64847-B900-48AD-A164-1B4F9B774650}" /qn