-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDRMM-WINSCR-EnableNET35.ps1
More file actions
26 lines (21 loc) · 929 Bytes
/
DRMM-WINSCR-EnableNET35.ps1
File metadata and controls
26 lines (21 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Enable verbose output
$VerbosePreference = "Continue"
# Check if .NET Framework 3.5 is already installed
$feature = Get-WindowsOptionalFeature -FeatureName NetFx3 -Online
if ($feature.State -eq "Enabled") {
Write-Verbose "The .NET Framework 3.5 is already installed."
} else {
Write-Verbose "Installing .NET Framework 3.5 using DISM..."
# Install .NET 3.5 using DISM
$logFile = "C:\ProgramData\CentraStage\Temp\DotNet35Install.log"
Write-Verbose "Writing log file to $logFile"
$dismCommand = "DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /NoRestart /LogPath:$logFile"
Invoke-Expression $dismCommand
# Verify installation
$feature = Get-WindowsOptionalFeature -FeatureName NetFx3 -Online
if ($feature.State -eq "Enabled") {
Write-Verbose "Installation successful!"
} else {
Write-Verbose "Installation failed. Check the log for details: $logFile"
}
}