From 8535bc026347393bac1645118b0330cb00f07094 Mon Sep 17 00:00:00 2001 From: Benedikt Graeb Date: Sun, 7 Jan 2018 11:18:24 +0100 Subject: [PATCH 1/2] Enhance optimize-windows-update.ps1 icacls shouldn't break with non-english images --- scripts/optimize-windows-update.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/optimize-windows-update.ps1 b/scripts/optimize-windows-update.ps1 index 3835e93..82b2a00 100644 --- a/scripts/optimize-windows-update.ps1 +++ b/scripts/optimize-windows-update.ps1 @@ -18,8 +18,11 @@ sp "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DeliveryOptimization" "DODownloadM #echo "Disabling automatic driver update" #sp "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching" "SearchOrderConfig" 0 +$objSID = New-Object System.Security.Principal.SecurityIdentifier "S-1-1-0" +$EveryOne = $objSID.Translate( [System.Security.Principal.NTAccount]).Value + echo "Disable 'Updates are available' message" takeown /F "$env:WinDIR\System32\MusNotification.exe" -icacls "$env:WinDIR\System32\MusNotification.exe" /deny "Everyone:(X)" +icacls "$env:WinDIR\System32\MusNotification.exe" /deny "$EveryOne:(X)" takeown /F "$env:WinDIR\System32\MusNotificationUx.exe" -icacls "$env:WinDIR\System32\MusNotificationUx.exe" /deny "Everyone:(X)" +icacls "$env:WinDIR\System32\MusNotificationUx.exe" /deny "$EveryOne:(X)" From e12fe640a0636105e2e1e2e739215846f3a6e697 Mon Sep 17 00:00:00 2001 From: Benedikt Graeb Date: Tue, 9 Jan 2018 07:28:12 +0100 Subject: [PATCH 2/2] Update optimize-windows-update.ps1 Fixed flaw with variable expansion --- scripts/optimize-windows-update.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/optimize-windows-update.ps1 b/scripts/optimize-windows-update.ps1 index ea9aef1..c56e832 100644 --- a/scripts/optimize-windows-update.ps1 +++ b/scripts/optimize-windows-update.ps1 @@ -26,6 +26,6 @@ echo "Disable 'Updates are available' message" Write-Output "Disable 'Updates are available' message" takeown /F "$env:WinDIR\System32\MusNotification.exe" -icacls "$env:WinDIR\System32\MusNotification.exe" /deny "$EveryOne:(X)" +icacls "$env:WinDIR\System32\MusNotification.exe" /deny "$($EveryOne):(X)" takeown /F "$env:WinDIR\System32\MusNotificationUx.exe" -icacls "$env:WinDIR\System32\MusNotificationUx.exe" /deny "$EveryOne:(X)" +icacls "$env:WinDIR\System32\MusNotificationUx.exe" /deny "$($EveryOne):(X)"