mtniehaus / AutopilotBranding

MIT License
276 stars 74 forks source link

Background (wallpaper) not working on some Win11 devices #10

Open Ilhan75 opened 6 months ago

Ilhan75 commented 6 months ago

Majority of computer will run this script and it works 100%, but lately some Windows 11 devices (not sure if touchscreen might be a factor) fail to setup background image on the user's desktop. When I look at log files it is all reported as successful. Any ideas or suggestions? THANK YOU.

mtniehaus commented 6 months ago

There's something odd going on in Windows -- it seems to be timing-dependent. I will run it on the same machine/VM 10 times in a row and one of them will not display the background.

Ilhan75 commented 6 months ago

Mike, I am impressed by how quickly you respond. THANK YOU. I haven't noticed any issues with Windows 10 devices. This happens only on new devices that come with Windows 11 (pre-installed). I am not sure if touchscreen might be a factor for the issue.

Ilhan

Ilhan Ramic

DWS Platform Engineer Digital Workplace Services (DWS)

Tel. (201) 431-8498

[Pearson] Learn more at pearson.comhttp://www.pearson.com/


From: Michael Niehaus @.> Sent: Friday, March 8, 2024 2:32 PM To: mtniehaus/AutopilotBranding @.> Cc: Ilhan Ramic @.>; Author @.> Subject: Re: [mtniehaus/AutopilotBranding] Background (wallpaper) not working on some Win11 devices (Issue #10)

There's something odd going on in Windows -- it seems to be timing-dependent. I will run it on the same machine/VM 10 times in a row and one of them will not display the background.

— Reply to this email directly, view it on GitHubhttps://github.com/mtniehaus/AutopilotBranding/issues/10#issuecomment-1986288585, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWSXDR6LFZX4JMQHGTL3AVDYXIG6DAVCNFSM6AAAAABENHCHW2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBWGI4DQNJYGU. You are receiving this because you authored the thread.Message ID: @.***>

gforal commented 5 months ago

I have noticed the same thing... I am testing Autopilot with a USB stick I made using the Surface Deployment Accelerator and a 23H2 WIM which was patched to February 2024. I deployed the branding script as a blocking app in the ESP.

I noticed that the DefaultUser InstallTheme value was reset sometime before the machine and user portions of enrollment. I also tried setting the "DefaultUser\Control Panel\Wallpaper" value and it was also reset to the normal img0 wallpaper. This behavior is very consistent with self-deployment.

vdmchkv commented 3 months ago

Hello @mtniehaus,

I think I have an explanation for this behaviour. Analysing the issue with a brand new Lenovo device with preinstalled Windows 11 23H2, I found that the image was prepared using the sysprep method. This also includes some activities after the enrolment, which are configured using unattended install. You can locate, for example, unattended.xml under C:\Windows\Panther\ as well as in the Microsoft Documentation here.

vdmchkv commented 3 months ago

As a follow-up to my post earlier today, I have implemented the following solution in my version of a similar branding script. Please consider incorporating it into yours as well. I am not creating a pull request, as I haven't had the option to test it properly.

Add function somewhere in your script. The purpose of the function is to check existence of particular value in registry

function Test-RegistryValue { param ( [parameter(Mandatory = $true)][ValidateNotNullOrEmpty()]$Path, [parameter(Mandatory = $true)][ValidateNotNullOrEmpty()]$Value ) try { Get-ItemProperty -Path $Path -ErrorAction Stop | Select-Object -ExpandProperty $Value -ErrorAction Stop | Out-Null return $true } catch { return $false } }

and then delete properties from OEMs within your script where setup Theme:

$HKLMThemePath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes" if (Test-RegistryValue -Path $HKLMThemePath -Value 'BrandIcon') { Remove-ItemProperty -Path $HKLMThemePath -Name 'BrandIcon' -Force } if (Test-RegistryValue -Path $HKLMThemePath -Value 'DesktopBackground') { Remove-ItemProperty -Path $HKLMThemePath -Name 'DesktopBackground' -Force } if (Test-RegistryValue -Path $HKLMThemePath -Value 'ThemeName') { Remove-ItemProperty -Path $HKLMThemePath -Name 'ThemeName' -Force } if (Test-RegistryValue -Path $HKLMThemePath -Value 'NoThemeInstall') { Remove-ItemProperty -Path $HKLMThemePath -Name 'NoThemeInstall' -Force }