Deploying Desktop wallpaper script in Azure Active Directory-Joined Windows 10 Pro devices

%3CLINGO-SUB%20id%3D%22lingo-sub-2579317%22%20slang%3D%22en-US%22%3EDeploying%20Desktop%20wallpaper%20script%20in%20Azure%20Active%20Directory-Joined%20Windows%2010%20Pro%20devices%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2579317%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EI%20followed%20the%20script%20alternative%20described%20in%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fmsendpointmgr.com%2F2021%2F02%2F02%2Fmanage-desktop-wallpaper-with-microsoft-intune%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmsendpointmgr.com%2F2021%2F02%2F02%2Fmanage-desktop-wallpaper-with-microsoft-intune%3C%2FA%3E%3CBR%20%2F%3E%3CSPAN%3EAnd%20I%20would%20like%20some%20assistance%20in%20regards%20to%20my%20client%E2%80%99s%20failure%20to%20take%20ownership%20message%20prompted.%20I%20have%20pushed%20this%20script%2C%20but%20I%20am%20getting%20log%20errors.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EI%20think%20it%20is%20important%20to%20notice%20this%20Win10%20Pro%20(19042.1052)%20client%E2%80%99s%20are%20all%20Azure%20Active%20Directory%20Joined%20and%20managed%20through%20the%20Microsoft%20Endpoint%20Manager%20and%20with%20Windows%20Defender%20turned%20on.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EThere%20are%20no%20local%20accounts%20in%20the%20devices.%20I%20noticed%20that%20I%20needed%20to%20change%20the%20Administrator%20and%20User%20security%20groups%20to%20match%20the%20local%20language%20(Spanish%20MX).%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EI%20do%20not%20know%20if%20there%20are%20other%20language%20groups%20to%20be%20changed%20in%20the%20script%2C%20or%20If%20I%20am%20missing%20out%20other%20reasons%20that%20could%20be%20preventing%20the%20for%20the%20taking%20ownership%20command%20to%20execute%20correctly.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20to%20run%20the%20script%20by%20logging%20in%20physically%20in%20one%20device%20and%20permissions%20are%20requested%20in%20a%20prompt%20window.%20Images%20downloaded%20and%20stored%20but%20it%20is%20not%20replacing.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CSPAN%3EThanks!%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2579317%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EIntune%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Elockscreen%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMobile%20Device%20Management%20(MDM)%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ewallpaper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2582674%22%20slang%3D%22en-US%22%3ERe%3A%20Deploying%20Desktop%20wallpaper%20script%20in%20Azure%20Active%20Directory-Joined%20Windows%2010%20Pro%20devices%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2582674%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20script%20should%20work%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%24RegKeyPath%20%3D%20%22HKLM%3A%5CSOFTWARE%5CMicrosoft%5CWindows%5CCurrentVersion%5CPersonalizationCSP%22%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%24DesktopPath%20%3D%20%22DesktopImagePath%22%3CBR%20%2F%3E%24DesktopStatus%20%3D%20%22DesktopImageStatus%22%3CBR%20%2F%3E%24DesktopUrl%20%3D%20%22DesktopImageUrl%22%3C%2FP%3E%3CP%3E%24StatusValue%20%3D%20%221%22%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%24url%20%3D%20%22%3CA%20href%3D%22https%3A%2F%2Fcall4cloud.nl%2Fexample.jpg%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fcall4cloud.nl%2Fexample.jpg%3C%2FA%3E%22%3CBR%20%2F%3EMd%20c%3A%5CMDM%20-force%3CBR%20%2F%3E%24DesktopImageValue%20%3D%20%22C%3A%5CMDM%5Cwallpaper.jpg%22%3CBR%20%2F%3E%24directory%20%3D%20%22C%3A%5CMDM%5C%22%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EIf%20((Test-Path%20-Path%20%24directory)%20-eq%20%24false)%3CBR%20%2F%3E%7B%3CBR%20%2F%3ENew-Item%20-Path%20%24directory%20-ItemType%20directory%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%24wc%20%3D%20New-Object%20System.Net.WebClient%3CBR%20%2F%3E%24wc.DownloadFile(%24url%2C%20%24DesktopImageValue)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eif%20(!(Test-Path%20%24RegKeyPath))%3CBR%20%2F%3E%7B%3CBR%20%2F%3EWrite-Host%20%22Creating%20registry%20path%20%24(%24RegKeyPath).%22%3CBR%20%2F%3ENew-Item%20-Path%20%24RegKeyPath%20-Force%20%7C%20Out-Null%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ENew-ItemProperty%20-Path%20%24RegKeyPath%20-Name%20%24DesktopStatus%20-Value%20%24Statusvalue%20-PropertyType%20DWORD%20-Force%20%7C%20Out-Null%3CBR%20%2F%3ENew-ItemProperty%20-Path%20%24RegKeyPath%20-Name%20%24DesktopPath%20-Value%20%24DesktopImageValue%20-PropertyType%20STRING%20-Force%20%7C%20Out-Null%3CBR%20%2F%3ENew-ItemProperty%20-Path%20%24RegKeyPath%20-Name%20%24DesktopUrl%20-Value%20%24DesktopImageValue%20-PropertyType%20STRING%20-Force%20%7C%20Out-Null%3C%2FP%3E%3CP%3ERUNDLL32.EXE%20USER32.DLL%2C%20UpdatePerUserSystemParameters%201%2C%20True%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2593366%22%20slang%3D%22en-US%22%3ERe%3A%20Deploying%20Desktop%20wallpaper%20script%20in%20Azure%20Active%20Directory-Joined%20Windows%2010%20Pro%20devices%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2593366%22%20slang%3D%22en-US%22%3EHi%20there%20Rudy!%3CBR%20%2F%3EThanks%20a%20lot%20for%20your%20input.%20I%20understand%20this%20script%20you%20are%20sharing%20should%20be%20used%20instead%20of%20the%20one%20I%20am%20using%20initially.%3CBR%20%2F%3E%3CBR%20%2F%3EParameters%20that%20should%20change%20are%20the%20value%20of%20the%20wallpaper%20where%20it%20is%20stored%20online.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20see%20that%20the%20main%20difference%20is%20that%20the%20download%20storage%20in%20the%20local%20PC%20in%20being%20done%20in%20less%20restricted%20folder%2C%20right%3F%3CBR%20%2F%3E%3CBR%20%2F%3EThanks!%3C%2FLINGO-BODY%3E
New Contributor

I followed the script alternative described in https://msendpointmgr.com/2021/02/02/manage-desktop-wallpaper-with-microsoft-intune
And I would like some assistance in regards to my client’s failure to take ownership message prompted. I have pushed this script, but I am getting log errors.

I think it is important to notice this Win10 Pro (19042.1052) client’s are all Azure Active Directory Joined and managed through the Microsoft Endpoint Manager and with Windows Defender turned on.

There are no local accounts in the devices. I noticed that I needed to change the Administrator and User security groups to match the local language (Spanish MX).

I do not know if there are other language groups to be changed in the script, or If I am missing out other reasons that could be preventing the for the taking ownership command to execute correctly.

 

I tried to run the script by logging in physically in one device and permissions are requested in a prompt window. Images downloaded and stored but it is not replacing.


Thanks!

4 Replies

This script should work 

 

$RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"


$DesktopPath = "DesktopImagePath"
$DesktopStatus = "DesktopImageStatus"
$DesktopUrl = "DesktopImageUrl"

$StatusValue = "1"


$url = "https://call4cloud.nl/example.jpg"
Md c:\MDM -force
$DesktopImageValue = "C:\MDM\wallpaper.jpg"
$directory = "C:\MDM\"


If ((Test-Path -Path $directory) -eq $false)
{
New-Item -Path $directory -ItemType directory
}

$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $DesktopImageValue)

 

if (!(Test-Path $RegKeyPath))
{
Write-Host "Creating registry path $($RegKeyPath)."
New-Item -Path $RegKeyPath -Force | Out-Null
}


New-ItemProperty -Path $RegKeyPath -Name $DesktopStatus -Value $Statusvalue -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $DesktopPath -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $DesktopUrl -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null

RUNDLL32.EXE USER32.DLL, UpdatePerUserSystemParameters 1, True

Hi there Rudy!
Thanks a lot for your input. I understand this script you are sharing should be used instead of the one I am using initially.

Parameters that should change are the value of the wallpaper where it is stored online.

I see that the main difference is that the download storage in the local PC in being done in less restricted folder, right?

Thanks!
Hi

Hi approach is a little bit different but his script downloads it in the c:\windows\web. You could change that part in the script itself. But then again, my script is way simpler (in my opinion :) ) it just downloads the file and sets the PersonalizationCSP :)
I am giving a try to this script. I will let you know how it went when I get some results back. Thanks!