Added confirmation for updates in deploy script

This commit is contained in:
Bram Prieshof
2022-03-18 15:15:39 +00:00
parent 71ab0008fb
commit 04b3601101

View File

@@ -28,11 +28,16 @@ $sysid = Read-Host -Prompt 'Please enter system ID (example: DT001)'
Rename-Computer -NewName $sysid Rename-Computer -NewName $sysid
Write-Output "System name [OK]" Write-Output "System name [OK]"
#Chocolaty software updates
$confirmSupdates = Read-Host "Run Software updates? (y/n)"
if ( $confirmSupdates -eq 'y'){
Write-Output "Checking Chocolatey package updates" Write-Output "Checking Chocolatey package updates"
choco upgrade -y all choco upgrade -y all
Write-Output " Chocolatey updates [OK]" Write-Output " Chocolatey updates [OK]"
}
$confirmWupdates = Read-Host "Run Windows updates? (y/n)"
if ( $confirmWupdates -eq 'y'){
#Enable Windows updates service #Enable Windows updates service
Set-Service -Name "wuauserv" -Status Stopped -StartupType Manual Set-Service -Name "wuauserv" -Status Stopped -StartupType Manual
@@ -40,6 +45,7 @@ Write-Output "Checking Windows updates"
Import-Module PSWindowsUpdate Import-Module PSWindowsUpdate
Get-WUInstall -MicrosoftUpdate -AcceptAll -IgnoreReboot -IgnoreRebootRequired -Install Get-WUInstall -MicrosoftUpdate -AcceptAll -IgnoreReboot -IgnoreRebootRequired -Install
Write-Output " Windows updates [OK]" Write-Output " Windows updates [OK]"
}
#Removing Created Shortcuts #Removing Created Shortcuts
Remove-Item C:\Users\Public\Desktop\*.lnk Remove-Item C:\Users\Public\Desktop\*.lnk