Reset and Re-register Windows Spotlight in Windows 10  

Page 22 of 25 FirstFirst ... 122021222324 ... LastLast

  1. Posts : 2,450
    Windows 10 Pro x64
       #210

    Hi @Ginosergio and welcome to Tenforums!

    To create your "Custom-made Spotlight", which will be changing LockScreen images from a predefined images folder, run this PowerShell script, from an elevated PowerShell console:

    Code:
    #Requires -RunAsAdministrator
    
    function Get-RandomNumber {
        $RandomBytes = New-Object -TypeName "System.Byte[]" 4
        $Random = New-Object -TypeName "System.Security.Cryptography.RNGCryptoServiceProvider"
        $Random.GetBytes($RandomBytes)
        [BitConverter]::ToInt32($RandomBytes, 0)
    }
    
    $RegistryKey = "Registry::\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"
    
    $ImagesFolder = "$env:USERPROFILE\Pictures\Wallpapers"
    
    $LockScreenImageValue = (Get-ChildItem -Path $ImagesFolder | Get-Random -SetSeed (Get-RandomNumber) -Count 1).FullName
    
    if (!(Test-Path $RegistryKey)) {
        New-Item -Path $RegistryKey -Force | Out-Null
    }
    
    # Create/Modify Registry entries for Lock Screen
    Set-ItemProperty -Path $RegistryKey -Name "LockScreenImageStatus" -Type DWord -Value 1 -Force
    Set-ItemProperty -Path $RegistryKey -Name "LockScreenImagePath" -Type String -Value $LockScreenImageValue -Force
    Set-ItemProperty -Path $RegistryKey -Name "LockScreenImageUrl" -Type String -Value $LockScreenImageValue -Force
    
    #Ensure the changes to the Lock screen image take place immediately
    rundll32.exe user32.dll, UpdatePerUserSystemParameters
    Upon execution, the script will create a new Registry key, to take over the LockScreen image changing function of the system.
    Every time it runs, it randomly selects one of the images in the specified images folder and sets it as your LockScreen image.
    It can be run on demand, but it works better if you schedule it to run, let's say daily and it will change the LockScreen image, the way Windows Spotlight is supposed to (whenever it works!!!)

    The file you save the script in, must have an extension .ps1

    It can be put in any convenient to you folder, as long as you reference it with its complete path (e.g. D:\Pictures\MyWallpapers\Set-LockScreen.ps1)

    In the script change the $ImagesFolder = "$env:USERPROFILE\Pictures\Wallpapers" to the folder your images will be. If you keep your images in "D:\Pictures\MyWallpapers", make it $ImagesFolder = "D:\Pictures\MyWallpapers".
    Just FYI, the $env:USERPROFILE prefix I have put in the script, is a PowerShell variable, for the folder C:\Users\<UserName>, but since the <UserName> is different for every user, PowerShell provides this so you can make the script generic i.e. to be used by anyone without knowing the UserName.

    For convenience you can download and use the following script, in which I took the liberty (according to your post) to make the images folder D:\Pictures\MyWallpapers.
    If that's the case you can use it as is: Set-LockScreen.ps1

    Now let’s go to the task, you need to create for our "Custom-made SpotLight":

    The task you create needs to open PowerShell and run the script. To do that just follow the screenshots below:

    In Task Scheduler select “Create Task”.
    Reset and Re-register Windows Spotlight in Windows 10-ts-1-.png

    In General tab give a name to your task and make sure you check “Run with highest privileges”.
    Reset and Re-register Windows Spotlight in Windows 10-ts-2-.png

    Then in the Triggers tab, click on Edit
    Reset and Re-register Windows Spotlight in Windows 10-ts-3-.png

    and schedule when the task will be running.
    Reset and Re-register Windows Spotlight in Windows 10-ts-4-.png

    In the Actions tab create a new Action to “Start a program” and in the “Program/script” field type (or Copy/Paste from here) the following:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

    In the “Add arguments (optional)” field type (or Copy/Paste from here) the following:
    -WindowStyle Hidden -NonInteractive -ExecutionPolicy Bypass -File "D:\Pictures\MyWallpapers\Set-LockScreen.ps1"
    provided that you put the script in the D:\Pictures\MyWallpapers folder, otherwise change it to the folder your Set-LockScreen.ps1 file resides.
    Reset and Re-register Windows Spotlight in Windows 10-ts-5-.png

    In the Conditions tab, if you wish you can check “Wake the computer to run this task”.
    Reset and Re-register Windows Spotlight in Windows 10-ts-6-.png

    In the Settings tab, make sure you check “Allow task to be run on demand” (for testing purposes) and the other options either leave them as shown in the picture or change according to your needs.
    Reset and Re-register Windows Spotlight in Windows 10-ts-7-.png

    Click OK and the task is done.

    Finally, there is nothing you do in Settings, to set this “Custom-made SpotLight”.

    Once you run the script, if you go to Settings > Personalization > Lock screen, you will see that you can’t change anything, since the Registry key the script adds, disables any selection.
    That is the last comment I made in my previous post. That if you want to bring back everything to what it was, before the script run, you have to go in the Registry and delete the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP
    Then everything will be again selectable as it was before, but you will not have your "Custom-made Spotlight"!

    I hope to have helped.
    Good luck with it and if you find any problem, do not hesitate to post back.

    Cheers. Dimitri
    Last edited by ddelo; 20 Feb 2021 at 00:58.
      My Computer


  2. Posts : 6
    Windows 10 - 2004
       #211

    Thank you Dimitri, now all is clear
    you are a fantastic teacher!

    Cheers
    Ginosergio

    - - - Updated - - -

    Here is my little contribution, for all those who want to adopt the "Personal Spotlight".
    My 4K Wallpapers collection:

    4K Wallpapers.zip - Google Drive

    Enjoy it ...
      My Computer


  3. Posts : 2,450
    Windows 10 Pro x64
       #212

    Ginosergio said:
    Thank you Dimitri, now all is clear
    you are a fantastic teacher!

    Cheers
    Ginosergio

    - - - Updated - - -

    Here is my little contribution, for all those who want to adopt the "Personal Spotlight".
    My 4K Wallpapers collection:

    4K Wallpapers.zip - Google Drive

    Enjoy it ...
    Most welcome mate!
      My Computer


  4. Posts : 6
    Windows 10 - 2004
       #213

    @ddelo

    Dimitri maybe I am missing something obvious.... This morning I had some time to create your script in my PC but after I complete the configuration in the Task scheduler and I click OK, the "new task" windows closes, but I cannot find anywhere my new task !!!
    I am searching it in the lower part of this window, but is not there... I also created it a second time, naming it "AAA_Change_lock_screen" (hoping to find it on top) but no way....
    Where is it ??????????

    Reset and Re-register Windows Spotlight in Windows 10-task.jpg

    - - - Updated - - -
    @ddelo

    don't mind.... I've found my task clicking on the second line on the left (Library....)
    The script works, and it changes the lock screen, but, last question:

    is it normal that after launching it for the test, the task does not end, and remains in execution ?

    Reset and Re-register Windows Spotlight in Windows 10-task2.jpg

    thank you !
      My Computer


  5. Posts : 2,450
    Windows 10 Pro x64
       #214

    Ginosergio said:
    - - - Updated - - -
    @ddelo

    don't mind.... I've found my task clicking on the second line on the left (Library....)
    The script works, and it changes the lock screen, but, last question:

    is it normal that after launching it for the test, the task does not end, and remains in execution ?

    Reset and Re-register Windows Spotlight in Windows 10-task2.jpg

    thank you !

    When you run a task manually (i.e you click Run ), in Task Scheduler, the task shows that is still running, until you press "Refresh". Task Scheduler does not refresh automatically. So, once you Run it, after 2-3 seconds press "Refresh" and you'll see that it shows "Completed".
      My Computer


  6. Posts : 6
    Windows 10 - 2004
       #215

    ddelo said:
    When you run a task manually (i.e you click Run ), in Task Scheduler, the task shows that is still running, until you press "Refresh". Task Scheduler does not refresh automatically. So, once you Run it, after 2-3 seconds press "Refresh" and you'll see that it shows "Completed".
    Thank you ! I'm so sorry, but for these things I'm really a beginner.
      My Computer


  7. Posts : 2,450
    Windows 10 Pro x64
       #216

    @Ginosergio
    Don't apologize. Being a beginner is half the way to expertise, because you're willing to learn!
    So, when you're not sure about something, just ask.
    Last edited by ddelo; 22 Feb 2021 at 13:41.
      My Computer


  8. Posts : 7,905
    Windows 11 Pro 64 bit
       #217

    Edge is not shown in the list of apps which can be selected to run in the background as indicated in the tutorial.
      My Computers


  9. Posts : 68,976
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #218

    Steve C said:
    Edge is not shown in the list of apps which can be selected to run in the background as indicated in the tutorial.
    "(only if listed)"

    In older versions of Windows 10 it was listed, but not now.
      My Computers


  10. Posts : 18
    Windows 10
       #219

    My assets folder is empty after doing a manual reset of Spotlight. Any idea on how to fix it?
      My Computer


 

Tutorial Categories

Reset and Re-register Windows Spotlight in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 09:50.
Find Us




Windows 10 Forums