Forum Discussion

JasonWilliams1974's avatar
JasonWilliams1974
Copper Contributor
Sep 06, 2021

Powershell - Lock screen & Desktop background issue

I am currently starting to configure for a smaller organisation, using Intune for MDM, I've managed to successfully change my Azure AD login to be a standard user (I don't want every user having full...
  • Rudy_Ooms_MVP's avatar
    Sep 06, 2021
    Some time ago I received the same question... This script worked perfectly for him (running as 64 bits and as system (Run this script using the logged on credentials --> no)


    $RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"
    $DesktopPath = "DesktopImagePath"
    $DesktopStatus = "DesktopImageStatus"
    $DesktopUrl = "DesktopImageUrl"
    $StatusValue = "1"
    $url = "https://call4cloud.nl/wp-content/uploads/2020/03/cropped-nieuw.jpg"
    $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

Resources