-1

I have Windows 10 laptop and I really like all the Lock Screen wallpapers that Windows change automatically occasionally. Is it possible to change the my desktop background with the same wallpaper at the same time?

  • superuser.com/questions/1014993/… Did you do any research prior to asking this here? I did a quick web search and there are TONS of guides to do this. Did you try any of these yet? Did they work or not? – music2myear Apr 5 at 17:48
  • @music2myear I definitely did. I am looking for automated way to change the desktop wallpaper, when the window spotlight changes the lock screen wallpaper. – Cricrazy Apr 5 at 17:52
1

From here: https://www.thewindowsclub.com/use-windows-spotlight-desktop-wallpaper-slideshow

Save the following as a Powershell script:

$files = gci $Env:LocalAppData\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets | where Length -gt 1kb

if ($files) {
    $shell = New-Object -ComObject Shell.Application
    #destination for pictures (if doesn't exist, will be created)
    $folder = "$Env:USERPROFILE\OneDrive\Pictures\Wallpaper\Spotlight"
    if (!(Test-Path $folder)) { mkdir $folder }
    $files | % {
        $_ | Copy-Item -Destination $folder\$_.jpg
        Get-Item $folder\$_.jpg
    } | % {
        $namespace = $shell.namespace($folder)
        $item = $namespace.ParseName($_.Name)
        $size = $namespace.GetDetailsOf($item, 31)
        if ($size -match '(\d+) x (\d+)') {
            $width = [int]($Matches[1])
            $height = [int]($Matches[2])
        }
        if (!$size -or $width -lt 1920 -or $height -lt 500) {
            Remove-Item $_
        }
    }
}

If you wish, modify the line $folder = "$Env:USERPROFILE\OneDrive\Pictures\Wallpaper\Spotlight" to place the files where you want them.

Save the following as an .xml file:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2017-11-23T15:57:26.1901555</Date>
    <Author>SP4\skeene</Author>
    <Description>Copies files larger than 1kb from "LocalAppData\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets" to "USERPROFILE\OneDrive\Pictures\Wallpaper\Spotlight\", omiting any files with a width less than 1920 or height less than 500 pixels.</Description>
    <URI>\Shawn Keene\Copy Spotlight Pictures</URI>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2017-11-23T23:55:00</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-21-744251132-1553713446-1048557590-1001</UserId>
      <LogonType>Password</LogonType>
      <RunLevel>LeastPrivilege</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <Duration>PT5M</Duration>
      <WaitTimeout>PT1H</WaitTimeout>
      <StopOnIdleEnd>false</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>true</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"</Command>
      <Arguments>-ExecutionPolicy Bypass -file "C:\Path\To\PowerShel\Script\savespotlight.ps1"</Arguments>
    </Exec>
  </Actions>
</Task>

If you modified the PowerShell script, you'll need to make matching change in the XML file. Also, you'll need to change the Arguments line to point to your Powershell script file location: <Arguments>-ExecutionPolicy Bypass -file "C:\Path\To\PowerShel\Script\savespotlight.ps1"</Arguments>

Open the Task Scheduler and import this XML as a scheduled task. Make any adjustments to the settings that you wish. Set the trigger to run this script daily.

Now open Settings > Personalize and set your Background to a Slideshow and select the folder you've specified as the source folder for the slideshow images.

  • Thank you so much. It works wonderfully. Now I can have all those really cool wallpapers as a desktop background. – Cricrazy Apr 9 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.