Forum Discussion

DanielMagMat's avatar
DanielMagMat
Copper Contributor
Jul 23, 2021

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

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!

  • 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

    • DanielMagMat's avatar
      DanielMagMat
      Copper Contributor
      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!
      • Rudy_Ooms_MVP's avatar
        Rudy_Ooms_MVP
        MVP
        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 🙂
    • Zenulbashar's avatar
      Zenulbashar
      Copper Contributor
      Hi Rudy_Ooms_MVP I am trying to deploy the periodically cycle walpaper with intunes. Users has got Win 10/11 devices in a hybrid joined environment and enrolled into intunes. currently we have GP in place with DC. Does the script you provided would work for my scenario as well?

Resources