Jump to content

Set lock screen picture windows 10


Recommended Posts

Hi!

Have created a simple script that will set the lock screen picture on  windows 10 computer.

The script below "works" in terms of it does everything stated in the script. But the lock screen dose not change.

I know this can be done with a GPO but we want to push this even to our smaller customers that dont have an AD environment.

What have I missed to let this script change the lock screen picture?

 

Thanks!

image.thumb.png.271783abcf4cf6740d6042e3aab28b45.png

Link to post
Share on other sites
  • 4 weeks later...
  • 3 months later...

$RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"
 
 
$LockScreenPath = "LockScreenImagePath"
$LockScreenStatus = "LockScreenImageStatus"
$LockScreenUrl = "LockScreenImageUrl"
 
$StatusValue = "1"
 
 
$customclientbackground = "C:\Program Files\BGInfo\DG_Custombackground.jpg"
$url = "CHANGETHIS TO SOME URL THAT YOU WANT TO DOWNLOAD THE IMAGE FROM"
$LockScreenImageValue = "C:\DTC\DTC-LockScreen.jpg"
$directory = "C:\DTC\"
 
 
if ((Test-Path -Path $directory) -eq $FALSE)
{
New-Item -Path $directory -ItemType directory
}

 

if ((Test-Path -Path $customclientbackground) -eq $FALSE)
{
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $LockScreenImageValue)
}
 else{
 Copy-Item -Path $customclientbackground -Destination $LockScreenImageValue
 }

 

 
 
if (!(Test-Path $RegKeyPath))
{
Write-Host "Creating registry path $($RegKeyPath)."
New-Item -Path $RegKeyPath -Force | Out-Null
}
 
 
New-ItemProperty -Path $RegKeyPath -Name $LockScreenStatus -Value $StatusValue -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $LockScreenPath -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $LockScreenUrl -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
 
RUNDLL32.EXE USER32.DLL, UpdatePerUserSystemParameters 1, TRUE

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...