Windows Lock Screen custom picture not working


QuicktellPro

Member
Member
Local time
3:59 PM
Posts
60
OS
Windows 11
Hi,
I'm running 24H2 and have changed the lock screen image to one of my photos having the same dimensions. If I type the Windows key and L, the photo is shown correctly, however, when I start the PC, the lock screen is always the default blue folding image. I know it's not really important, but is there a workaround I can use to make the lock screen always show my photo, please?

lockscreen_settings.webp
 
Windows Build/Version
24H2

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K
My impression is Settings will sometimes forget to update all the necessary reg values.

So I wrote a batch script to force it to work.
Code:
LockScreen.bat \path\to\image.jpg
 

Attachments

My Computer

System One

  • OS
    Windows 7
Thank you very much, that fixed it!
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K
Incidentally, the only reason I changed my lock screen picture was because Windows spotlight does not work. I tried that setting numerous times but Windows always changed it back to picture.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K
My impression is Settings will sometimes forget to update all the necessary reg values.

So I wrote a batch script to force it to work.
Code:
LockScreen.bat \path\to\image.jpg
It's doing it again. Perhaps I didn't use your batch script correctly.
I ignored the line of code you provided because I did not know what it meant. Instead, I opened the script with Notepad and changed the 2 items I felt were relevant being USERNAME and image.jpg. After saving it with a .bat extension, I ran it as administrator. Could you check it for me please Garlin, and if I have gone wrong, let me know what needs changing.
 

Attachments

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K
This should be a full pathname with file extension.
Code:
if ($args[0] -eq '') {
    $Filename = 'C:\Windows\Web\Screen\img134d.jpg'
}

I don't understand this change. What is user profile environment variable "AE"?
Code:
$SID = (Get-LocalUser -Name $env:ae).SID

The script has to lookup your account name, in order to find your SID. The reg values are written for each user, based on their unique SID.
 

My Computer

System One

  • OS
    Windows 7
This should be a full pathname with file extension.
Code:
if ($args[0] -eq '') {
    $Filename = 'C:\Windows\Web\Screen\img134d.jpg'
}

I don't understand this change. What is user profile environment variable "AE"?
Code:
$SID = (Get-LocalUser -Name $env:ae).SID

The script has to lookup your account name, in order to find your SID. The reg values are written for each user, based on their unique SID.
I have modified it again according to your comments. Can you check it for me please.

Also, what did you mean by this: LockScreen.bat \path\to\image.jpg

Is that something I have to run from the terminal?
 

Attachments

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K
I have modified it again according to your comments. Can you check it for me please.

Also, what did you mean by this: LockScreen.bat \path\to\image.jpg

Is that something I have to run from the terminal?
You have to run the script from a Terminal session.

My script makes no assumptions about your current reg values (maybe they're broken?). So it forces all of the settings at the same time. If you edited the script to allow for no command-line arguments, then the image filename is now optional.
 

My Computer

System One

  • OS
    Windows 7
If you edited the script to allow for no command-line arguments, then the image filename is now optional.
Sorry, but I do not understand what you meant by that. I am only an intermediate user and know almost nothing about command-line operations. The only change I made to your script was the precise location of the image file I want to use. I reverted the 'ae' change back to 'USERNAME' following your previous post.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K
If you don't like having a command-line option to pick the image, then you can force the same image filename inside the script. Now you don't have to do anything but to run the script by hand, or double-click it from Explorer.

Code:
<# : batch script
@echo off
powershell -nop ^
"if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { ^
    Start-Process 'cmd' -ArgumentList '/c start /min %~dpnx0' -Verb RunAs ^
} ^
else { ^
    Invoke-Expression ([System.IO.File]::ReadAllText('%~f0')) ^
}"
goto :eof
#>

$Filename = 'C:\Windows\Web\Screen\img134d.jpg'

if ((Get-Item $Filename -ErrorAction SilentlyContinue) -eq $null) {
    "ERROR: $Filename not found."
    exit 1
}

$FullName = (Get-Item $Filename).FullName

$SID = (Get-LocalUser -Name $env:USERNAME).SID

$Path = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager'
Set-ItemProperty -Path $Path -Name 'RotatingLockScreenEnabled' -Value 0 -Force
Set-ItemProperty -Path $Path -Name 'RotatingLockScreenOverlayEnabled' -Value 0 -Force
Set-ItemProperty -Path $Path -Name 'SubscribedContent-338387Enabled' -Value 0 -Force

$Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Creative\$SID"
$null = New-Item -Path $Path -Force
$null = New-ItemProperty -Path $Path -Name 'RotatingLockScreenEnabled' -Value 0 -Force
$null = New-ItemProperty -Path $Path -Name 'RotatingLockScreenOverlayEnabled' -Value 0 -Force

$Path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP'
$null = New-Item -Path $Path -Force
Set-ItemProperty -Path $Path -Name 'LockScreenImageStatus' -Value 1 -Force
Set-ItemProperty -Path $Path -Name 'LockScreenImagePath' -Value $FullName -Force
Set-ItemProperty -Path $Path -Name 'LockScreenImageUrl' -Value $FullName -Force

$Path = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization'
$null = New-Item -Path $Path -Force
Set-ItemProperty -Path $Path -Name 'NoLockScreen' -Value 0 -Force
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\System' -Name 'DisableLogonBackgroundImage' -Value 0 -Force
 

My Computer

System One

  • OS
    Windows 7
Isn't that the same as the modified script I last sent you?
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K
No, because I removed all the argument passing and checking. 4 lines have changed.
 

My Computer

System One

  • OS
    Windows 7
No, because I removed all the argument passing and checking. 4 lines have changed.
Ok, thanks for that. I will run it again.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K
No, because I removed all the argument passing and checking. 4 lines have changed.
I ran it and at first it worked, but for the last 3 days the lock screen shows the default blue image on startup, even though my image is selected in the Lock screen section of settings. I tried running your script again and rebooting but it just won't change. The odd thing is that it works perfectly when manually locking the screen with the Windows + L keys.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K
You've probably got some Windows corruption. Try creating a new local user, and checking if the problem follows the test account.
 

My Computer

System One

  • OS
    Windows 7
try this .bat. obviously set the path to and name of image file desired. run batch as admin

Code:
copy "C:\path\to\LockScreen.png" "C:\Windows\Web\Screen\Lockscreen.png"

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP /v LockScreenImagePath /t REG_SZ /d "C:\Windows\Web\Screen\Lockscreen.png" /f
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP /v LockScreenImageUrl /t REG_SZ /d "C:\Windows\Web\Screen\Lockscreen.png" /f

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP /v LockScreenImageStatus /t REG_DWORD /d 1 /f
 

My Computer

System One

  • OS
    Windows 11 Pro
try this .bat. obviously set the path to and name of image file desired. run batch as admin
try this .bat. obviously set the path to and name of image file desired. run batch as admin

Code:
copy "C:\path\to\LockScreen.png" "C:\Windows\Web\Screen\Lockscreen.png"

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP /v LockScreenImagePath /t REG_SZ /d "C:\Windows\Web\Screen\Lockscreen.png" /f
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP /v LockScreenImageUrl /t REG_SZ /d "C:\Windows\Web\Screen\Lockscreen.png" /f

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP /v LockScreenImageStatus /t REG_DWORD /d 1 /f
I am only an intermediate user so I do not really understand your script, nor how to personalize it to my needs. If I send you the path to the image I want to use via PM, could you modify the script for me, please?
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K
You've probably got some Windows corruption. Try creating a new local user, and checking if the problem follows the test account.
Same thing happened in the test account. My image shows fine when using Win key + L but always defaults to the standard blue image on startup.

FWIW, I performed a health restore before running the test.

I'm thinking one possible solution could be to delete or rename all the default blue images and then give my image the same names the originals had. Of course, any subsequent Windows health checks would result in a corrupted files report because the file sizes would not be the same. Worth trying or not?
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K
The only reason it would revert on startup, is your PC has a Group Policy that resets to the same default.

1. Change the lock screen image. Don't restart.
2. Run as Administrator "gpupdate /force"
3. Check the lock screen again. Did it go back?
 

My Computer

System One

  • OS
    Windows 7
The only reason it would revert on startup, is your PC has a Group Policy that resets to the same default.

1. Change the lock screen image. Don't restart.
2. Run as Administrator "gpupdate /force"
3. Check the lock screen again. Did it go back?
I can't restart right now but I have done as you suggested. I will let you know the result tomorrow after startup.
I don't think I had any group policy unless it was set by Dell before I received the machine. What exactly does gpupdate /force do, and is there any danger I will need to restore back to the way it was?
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Alienware A51 R2
    CPU
    Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory
    32,0 GB
    Graphics Card(s)
    Nvidia GeForce RTX2080 Super
    Sound Card
    Realtek
    Screen Resolution
    4K

Latest Support Threads

Back
Top Bottom