@@ -192,6 +192,9 @@ function Set-WAUConfig {
192192 Write-Host " Creating Run WAU desktop shortcut (schedule disabled)..." - ForegroundColor Yellow
193193 Add-Shortcut $runWAUDesktopShortcut " ${env: SystemRoot} \System32\conhost.exe" " $ ( $currentConfig.InstallLocation ) " " --headless powershell.exe -NoProfile -ExecutionPolicy Bypass -File `" $ ( $currentConfig.InstallLocation ) User-Run.ps1`" " " $icon " " Winget AutoUpdate" " Normal"
194194 $shortcutsChanged = $true
195+ # Mirror shortcut creation to registry
196+ Set-ItemProperty - Path $regPath - Name ' WAU_DesktopShortcut' - Value 1 - Force
197+ Write-Host " Updated registry: WAU_DesktopShortcut = 1 (shortcut created)" - ForegroundColor Cyan
195198 }
196199 }
197200 # Remove Run WAU desktop shortcut if schedule is enabled and desktop shortcuts are disabled
@@ -201,6 +204,9 @@ function Set-WAUConfig {
201204 Write-Host " Removing Run WAU desktop shortcut (schedule enabled and desktop shortcuts disabled)..." - ForegroundColor Yellow
202205 Remove-Item - Path $runWAUDesktopShortcut - Force
203206 $shortcutsChanged = $true
207+ # Mirror shortcut removal to registry
208+ Set-ItemProperty - Path $regPath - Name ' WAU_DesktopShortcut' - Value 0 - Force
209+ Write-Host " Updated registry: WAU_DesktopShortcut = 0 (shortcut removed)" - ForegroundColor Cyan
204210 }
205211 }
206212
@@ -220,10 +226,25 @@ function Set-WAUConfig {
220226 Write-Host " Removing Run WAU desktop shortcut (Start Menu created and desktop shortcuts disabled)..." - ForegroundColor Yellow
221227 Remove-Item - Path $runWAUDesktopShortcut - Force
222228 $shortcutsChanged = $true
229+ # Mirror shortcut removal to registry
230+ Set-ItemProperty - Path $regPath - Name ' WAU_DesktopShortcut' - Value 0 - Force
231+ Write-Host " Updated registry: WAU_DesktopShortcut = 0 (shortcut removed)" - ForegroundColor Cyan
223232 }
224233 }
225234 }
226-
235+
236+ # Mirror actual desktop shortcut status to registry
237+ $runWAUDesktopShortcut = " ${env: Public} \Desktop\Run WAU.lnk"
238+ $actualShortcutExists = Test-Path $runWAUDesktopShortcut
239+ $currentDesktopSetting = $currentConfig.WAU_DesktopShortcut
240+ $correctRegistryValue = if ($actualShortcutExists ) { 1 } else { 0 }
241+
242+ if ($currentDesktopSetting -ne $correctRegistryValue ) {
243+ Set-ItemProperty - Path $regPath - Name ' WAU_DesktopShortcut' - Value $correctRegistryValue - Force
244+ Write-Host " Mirrored desktop shortcut status to registry: WAU_DesktopShortcut = $correctRegistryValue (shortcut exists: $actualShortcutExists )" - ForegroundColor Magenta
245+ $shortcutsChanged = $true
246+ }
247+
227248 # Show summary of changes
228249 if ($registryChanged -or $shortcutsChanged -or $scheduleChanged ) {
229250 $changesSummary = @ ()
0 commit comments