I'm new to this product, and this will be the third application of many that I will be using it with. I'm trying to install Lenovo's System Update, but first I would like it to detect the OS version - since Windows 8 does not have .Net Fx 3.5 enabled by default and it is a pre-requisite. I would like it to detect if it is Windows 8 or higher, if .Net Fx 3.5 is enabled, if not Enable it and then install LSU. If less than Windows 8, just install LSU. I've been having problems getting it to work, and could use some advise, I am quite new to PowerShell, as I am transitioning from batch deployments.
Here is what I have so far.
Here is what I have so far.
#*===============================================
#* INSTALLATION
$installPhase = "Installation"
#*===============================================
# Perform installation tasks here
# Get the OS version
$osVersion = [version]$($envOS.version)
$netFX = (Get-WindowsOptionalFeature -Online -FeatureName NetFx3).State
# Check if OS version is Windows 8 or greater
If ($osVersion -ge 6.2) {
# 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"){Enable-WindowsOptionalFeature –Online –FeatureName NetFx3 –All -LimitAccess -Source $dirSupportFiles\sources\sxs}
# 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
elseif ($netFX -eq "$Enabled"){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) {
Execute-Process -FilePath "systemupdate505-02-14-2014.exe" -Arguments "-s -a /s /v" /qn CREATESHORTCUT=1 REBOOT=R
}