From a3da939025c31f29e97cc0bdf60d5b666dc70382 Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Fri, 10 Jun 2022 14:12:15 +0200 Subject: [PATCH] Added auto Prepend for systemname and removed enableing/disableing WU Now prepending 'PC' to the given input (assetID), since windows refuses system name only consisting of numbers. Removed setting status of Windows updates services since this did not work, this feature was meant to pause WU until the system was activated, to prevent the network form being overloaded --- DeployTools/Deploy-FirstBoot.ps1 | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/DeployTools/Deploy-FirstBoot.ps1 b/DeployTools/Deploy-FirstBoot.ps1 index 7f3579e..97627de 100644 --- a/DeployTools/Deploy-FirstBoot.ps1 +++ b/DeployTools/Deploy-FirstBoot.ps1 @@ -16,16 +16,13 @@ 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-Output "Activation [OK]"} else {Write-Output "Activation [Error, Opening settings]";Start-Process "ms-settings:activation"; pause } Write-Output "Getting System name" $sysid = Read-Host -Prompt 'Please enter asset ID:' -Rename-Computer -NewName $sysid +Rename-Computer -NewName "PC$sysid" Write-Output "System name [OK]" #Chocolaty software updates @@ -38,9 +35,6 @@ if ( $confirmSupdates -eq 'y'){ $confirmWupdates = Read-Host "Run Windows updates? (y/n)" if ( $confirmWupdates -eq 'y'){ - #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