This worked for me. The first script that fixes Lockscreen Spotlight to refresh daily, if it isn't.


DuguaySarah94

Member
Local time
4:25 AM
Posts
1
OS
Windows 11
Hi, I am by no means tech-savvy; however, my employers, a small business with fewer than 10 employees, asked me to evaluate and test the built-in Copilot feature in Windows to see if it could streamline processes in our office. I was selected for this bc as their research consultant and data analyst, and I'm essentially the only employee using a laptop throughout the day!

As a way to familiarize myself with software that I have never been trained on, I decided to address a problem that has plagued my HP laptop for over a year. I could never get the default blue lock screen to refresh, as in the spotlight feature, to work, including its daily refresh of new backgrounds.

I created an account here to share the script that Copilot generated, as all the fixes I attempted over the years came from this site. Any Google searches I conducted usually led me back here, so I thought it would be helpful to share this solution with others who may be experiencing the same issue.

Below is the script. It indicated that it should be run in PowerShell as an Administrator.

--Sarah

# ============================================================
# Reset-WindowsSpotlight.ps1
# This script resets Windows Spotlight (the lock screen refresh feature)
# by clearing its cache, re-registering its package, and re-enabling
# the rotating lock screen background in Windows 11.
#
# IMPORTANT:
# - Run this script as Administrator.
# - Ensure no Group Policy or enterprise management is imposing
# a custom lock screen.
#
# Tested on Windows 11 24H2 (May 2025 release).
# ============================================================

# Check for Administrator privileges.
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Error "This script must be run as Administrator. Exiting."
exit 1
}

Write-Output "Starting Windows Spotlight reset process..."

# Step 1: Define paths for Spotlight cached assets and settings.
$spotlightAssetsPath = "$env:LOCALAPPDATA\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"
$spotlightSettingsPath = "$env:LOCALAPPDATA\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\Settings"

# Step 2: Delete cached images and settings.
if (Test-Path $spotlightAssetsPath) {
Remove-Item "$spotlightAssetsPath\*" -Force -Recurse -ErrorAction SilentlyContinue
Write-Output "Cleared Spotlight Assets: $spotlightAssetsPath"
} else {
Write-Output "Spotlight Assets folder not found at: $spotlightAssetsPath"
}

if (Test-Path $spotlightSettingsPath) {
Remove-Item "$spotlightSettingsPath\*" -Force -Recurse -ErrorAction SilentlyContinue
Write-Output "Cleared Spotlight Settings: $spotlightSettingsPath"
} else {
Write-Output "Spotlight Settings folder not found at: $spotlightSettingsPath"
}

# Step 3: Re-register the Windows Spotlight package.
Write-Output "Re-registering Windows Spotlight package..."
try {
Get-AppxPackage -allusers Microsoft.Windows.ContentDeliveryManager | ForEach-Object {
Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml" -ErrorAction Stop
}
Write-Output "Successfully re-registered Windows Spotlight."
} catch {
Write-Error "Error re-registering Windows Spotlight: $($_.Exception.Message)"
}

# Step 4: Ensure that Windows Spotlight (rotating lock screen) is enabled.
$registryPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
if (-not (Test-Path $registryPath)) {
New-Item -Path $registryPath -Force | Out-Null
}
# Enable the rotating lock screen background.
Set-ItemProperty -Path $registryPath -Name "RotatingLockScreenEnabled" -Value 1 -Type DWord
Write-Output "Enabled rotating lock screen background in registry."

# Step 5: Refresh group policies and system parameters.
Write-Output "Refreshing group policies and system parameters..."
try {
gpupdate /force | Out-Null
rundll32.exe user32.dll,UpdatePerUserSystemParameters ,1 ,True
Write-Output "Policies and system parameters updated."
} catch {
Write-Warning "Unable to fully refresh system parameters. A restart may be required."
}

Write-Output "Windows Spotlight reset process complete."
Write-Output "Please restart your computer to ensure all changes take effect."
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    HP
    CPU
    I don't know
    Motherboard
    IDK
    Memory
    IDK
    Graphics Card(s)
    Intel
    Sound Card
    ?
    Monitor(s) Displays
    32 inches
    Screen Resolution
    IDK
    Hard Drives
    IDK
    PSU
    IDK
    Case
    HP
    Cooling
    ?
    Keyboard
    Razer
    Mouse
    Razer
    Internet Speed
    Office
    Browser
    Windows 11
    Antivirus
    ?
Welcome to the forum. I do believe I remember several threads regarding spotlight refresh. It is very kind of you to share your solution. Since not only is the forum searchable, your thread will also show up in web search, so we appreciate any and all input that may help anyone coming to the forum for assistance. Thank you.
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 24H2 26100.4061
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Optiplex 7080
    CPU
    i9-10900 10 core 20 threads
    Motherboard
    DELL 0J37VM
    Memory
    32 gb
    Graphics Card(s)
    none-Intel UHD Graphics 630
    Sound Card
    Integrated Realtek
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    1tb Solidigm m.2 nvme+256gb SKHynix m.2 nvme /External drives 512gb Samsung m.2 sata+1tb Kingston m2.nvme+ 4gb Solidigm nvme
    PSU
    500w
    Case
    MT
    Cooling
    Dell Premium
    Keyboard
    Logitech wired
    Mouse
    Logitech wireless
    Internet Speed
    so slow I'm too embarrassed to tell
    Browser
    #1 Edge #2 Firefox
    Antivirus
    Defender+MWB Premium
  • Operating System
    Windows 11 Pro 24H2 26100.4061
    Computer type
    PC/Desktop
    Manufacturer/Model
    Beelink Mini PC SER5
    CPU
    AMD Ryzen 7 6800U
    Memory
    32 gb
    Graphics card(s)
    integrated
    Sound Card
    integrated
    Monitor(s) Displays
    Benq 27
    Screen Resolution
    2560x1440
    Hard Drives
    1TB Crucial nvme
    Mouse
    Logitech wireless
    Keyboard
    Logitech wired
    Internet Speed
    still too embarrassed to tell
    Browser
    Firefox
    Antivirus
    Defender
    Other Info
    System 3 is non compliant Dell 9020 i7-4770/24gb ram Win11 PRO 26100.4061
I could never get the default blue lock screen to refresh, as in the spotlight feature, to work, including its daily refresh of new backgrounds.

I've carefully made sure that the PCs I look after keep to a plain single colour lock screen. So I won't be testing this.

What is interesting is that copilot assumes that ordinary users belong to the administrators group. If you use a separate administrative account, then the script probably won't work, as clearing the cache and settings and fixing the registry entry to enable the rotating lock screen are per-user settings, but these will be done to the administrator account, not the user whose lock screen isn't rotating.
 

My Computer

System One

  • OS
    Windows 11 23H2 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    MSI
    CPU
    i3-1215U
    Memory
    8GB
    Monitor(s) Displays
    Dell S2721
    Screen Resolution
    3840x2160
    PSU
    External 65W
    Keyboard
    Cherry mechanical (Blue)
    Mouse
    Microsoft
    Browser
    FireFox
    Antivirus
    MS
What is interesting is that copilot assumes that ordinary users belong to the administrators group. If you use a separate administrative account, then the script probably won't work, as clearing the cache and settings and fixing the registry entry to enable the rotating lock screen are per-user settings, but these will be done to the administrator account, not the user whose lock screen isn't rotating.
A workaround is to create an elevated scheduled task, which runs the script on behalf of the user, and then provide the user a shortcut or batch file to call the task. This has been covered several times on this forum with other desktop fixes.

Yes. Don't believe everything Copilot suggests... Always test.
 

My Computer

System One

  • OS
    Windows 7
A workaround is to create an elevated scheduled task, which runs the script on behalf of the user,
So, how do you pass the identity (SID) of the user to the scheduled task? In this case you can use the scheduled task only for the part that requires elevation. But there are cases where you'd need to pass that information. I thought it might be possible by creating an event which logged the user ID and using an event trigger for the scheduled task, but didn't follow that up.
 

My Computer

System One

  • OS
    Windows 11 23H2 Pro
    Computer type
    PC/Desktop
    Manufacturer/Model
    MSI
    CPU
    i3-1215U
    Memory
    8GB
    Monitor(s) Displays
    Dell S2721
    Screen Resolution
    3840x2160
    PSU
    External 65W
    Keyboard
    Cherry mechanical (Blue)
    Mouse
    Microsoft
    Browser
    FireFox
    Antivirus
    MS
One solution (which follows the 80/20 rule) is to check who's logged on. This doesn't work so well if you have inbound Remote Desktop Sessions or user switching going on, but it's good enough for 80% of normal home users.

Code:
$CurrentUser = (Get-CimInstance -ClassName Win32_LoggedOnUser).Antecedent.Name
$SID = (Get-LocalUser $CurrentUser).SID.Value
$HomePath = (Get-CimInstance Win32_UserProfile -Filter "SID = '$SID'").LocalPath
$LOCALAPPDATA = "$HomePath\AppData\Local"
 

My Computer

System One

  • OS
    Windows 7

Latest Support Threads

Back
Top Bottom