Skip to main content
Question

.NET 4.8 installer


schweeeeet
Forum|alt.badge.img

Here is a worklet for installing .NET 4.8.  It checks the registry location for the version number and if it is not 4.8, it will install.  *whoops, didnt mean for this to be labeled a question*

THIS INSTALL REQUIRES A REBOOT TO FINALIZE INSTALLATION!

############################################################
### ~~~ SWEET'S .NET 4.8 INSTALL SCRIPT FOR AUTOMOX! ~~~ ###
############################################################
### --NOTES-- ### 
##############################################################################   
###  - Set the version of the executable for the program as it displays in ###
###    properties of the file                                              ###
###  - Set the path to the executable file                                 ###
###  - Set the name of the log file                                        ###
###  - Copy/Paste into Worklet!!                                           ###
##############################################################################


#################################################################
###   ><><><><><><   START EVALUATION CODE!!!  ><><><><><><   ###
#################################################################

# VARIABLES LIST

$swname = ".NET 4.8" # ex. ".NET 4.8"

$regpath = "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" # ex. "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"

$regversion = "4.8.03761" # ex. "4.8.03761"

$regkeyname = "Version" # ex. "Version"

$logname = "NET_4.8_INSTALL.log" # ex. "OfficeUpgrade.log"

# Create C:\Temp if it doesn't yet exist

New-Item -Path 'C:\Temp' -ItemType Directory -Force -ErrorAction SilentlyContinue

# Start logging

Start-Transcript -Verbose -Path "C:\Temp\$logname"

# Checks to see if .NET 4.8 is installed.

$output = Get-ItemPropertyValue $regpath -Name $regkeyname 

if ($output -ge $regversion){
  Write-Output "$swname is already installed."
 } else { 
  Write-Output "$swname not present - installer will begin shortly."
}

Stop-Transcript

if ($output -ge $regversion){
  Exit 0
 } else { 
  Exit 1  
}

#################################################################
###   ><><><><><><   END EVALUATION CODE!!!!!  ><><><><><><   ###
#################################################################

# COPY ABOVE THIS LINE INTO EVALUATION PANE

#---------------------------------------------------------------#

# COPY BELOW THIS LINE INTO REMEDIATION PANE

#################################################################
###   ><><><><><><   START REMEDIATION CODE!!  ><><><><><><   ###
#################################################################

# Set Variables!

$swname = ".NET 4.8" # ex. "Java 8.341 (32-bit)"

$swfilename = "ndp48-x86-x64-allos-enu.exe" # ex. "setup.exe"

$logname = "NET_4.8_INSTALL.log" # ex. "OfficeUpgrade.log"

$arguments = "/quiet" # ex. '/i "MicrosoftEdgeEnterpriseX64.msi" /q' TOP TIP! - You may need to use single quotes at the start/end!!

# Starts logging and appends the existing log file created by the Evaluation code

Start-Transcript -Verbose -Path "C:\Temp\$logname" -Append

Write-Output "Copying install files..."

Copy-Item $swfilename -Destination "C:\Temp" -Verbose

Write-Output "Install files copied to C:\Temp."

Write-Output "Executing install command..."

# Executing installer - DO NOT make your life harder, eliminate spaces in filenames!
    try
    {
        Start-Process "C:\Temp\$swfilename" -ArgumentList $arguments -Wait

    }
    catch
    {
        Write-Output "Install of $swname Failed"
        Exit -1
    }
    Write-Output "$swname install command executed."

    Remove-Item -Path "C:\Temp\$swfilename"

Stop-Transcript

#################################################################
###   ><><><><><><   END REMEDIATION CODE!!!!  ><><><><><><   ###
#################################################################

 

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings