-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInstall-WindowsFeatureUpdate.ps1
More file actions
40 lines (24 loc) · 1.07 KB
/
Install-WindowsFeatureUpdate.ps1
File metadata and controls
40 lines (24 loc) · 1.07 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13
# Log file location
$LogFilePath = "$env:SystemDrive\Temp"
# If $LogFilePath doesn't exist, create it
if (!(Test-Path $LogFilePath)) {
try {
mkdir $LogFilePath -Force -ErrorAction Stop
} catch {
Write-Output "Unable to create $LogFilePath, exiting"
}
}
try {
Write-Output "$(Get-Date -Format O) : Starting feature update install."
Start-Process -FilePath '.\setup.exe' -ArgumentList "/auto upgrade /quiet /copylogs $LogFilePath /noreboot /eula accept /showoobe none"
} catch {
Write-Output 'Feature update failed. Exiting script.'
}
do {
Write-Output "$(Get-Date -Format O) : Installing feature update."
Start-Sleep -Seconds 300
} while (
$(Get-Process | Where-Object Path -Like '*action1*setup*' | Measure-Object).Count -ge 1
)
Write-Output "$(Get-Date -Format O) : Feature update install completed."