Fixed install and deploy tools

This commit is contained in:
2021-07-16 13:36:59 +02:00
parent ca328d118c
commit 4fe6fe40c5
6 changed files with 26 additions and 5 deletions

View File

@@ -16,6 +16,9 @@ if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent
}
}
#Disable Windows updates service
Set-Service -Name "wuauserv" -Status Stopped -StartupType Disabled
Write-Output "Checking activation status..."
$ta = Get-CimInstance -ClassName SoftwareLicensingProduct -Filter "PartialProductKey IS NOT NULL" | Where-Object -Property Name -Like "Windows*"
if ($ta.LicenseStatus -eq 1) {Write-Outpute-Output "Activation [OK]"} else {Write-Output "Activation [Error, Opening settings]";Start-Process "ms-settings:activation"; pause }
@@ -30,6 +33,9 @@ Write-Output "Checking Chocolatey package updates"
choco upgrade -y all
Write-Output " Chocolatey updates [OK]"
#Enable Windows updates service
Set-Service -Name "wuauserv" -Status Stopped -StartupType Manual
Write-Output "Checking Windows updates"
Import-Module PSWindowsUpdate
Get-WUInstall -MicrosoftUpdate -AcceptAll -IgnoreReboot -IgnoreRebootRequired -Install