- Save
_pull.ps1somehere; I threw mine under:Pictures/windows login backgrounds - Open Windows Task Scheduler
- Create a new folder under
Task Scheduler Library Import Task...Triggerstab: you may need to change the triggers to match your userActionstab: make sure to point the path to_pull.ps1
Last active
July 17, 2025 17:32
-
-
Save ctsstc/dbbb97197da62a198d1afa38fa66a52f to your computer and use it in GitHub Desktop.
Save Microsoft Login Background on Login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Set the working path to the script's path | |
| $scriptpath = $MyInvocation.MyCommand.Path | |
| $dir = Split-Path $scriptpath | |
| # Write-host "My directory is $dir" | |
| Push-Location $dir | |
| # Create backgrounds directory if it does not exist | |
| if (!(Test-Path .\backgrounds)) { New-Item -ItemType Directory -Path .\backgrounds } | |
| # Get the path to the Windows login backgrounds for the current user | |
| $WindowsImagesPath = "$env:USERPROFILE\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets" | |
| # Copy images from the path to the backgrounds directory here | |
| cp -r $windowsImagesPath\* .\backgrounds | |
| # add jpg extension to all files in the backgrounds directory without a jpg extension using Move-Item -Force | |
| Get-ChildItem -Path .\backgrounds -Exclude *.jpg -Recurse | ForEach-Object { Move-Item -Path $_.FullName -Destination "$($_.FullName).jpg" -Force } | |
| # Rename-Item doesn't seem to support overwriting; don't let it's -Force flag fool you either -- that's not what it does | |
| # Get-ChildItem -Path .\backgrounds -Exclude *.jpg -Recurse | Rename-Item -NewName { $_.Name + ".jpg" } -Force | |
| # Useful to debug the window before it goes away if there's any errors | |
| # Write-Host "Press any key to continue..." | |
| # $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-16"?> | |
| <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"> | |
| <RegistrationInfo> | |
| <Date>2023-02-09T01:11:38.3033556</Date> | |
| <Author>Coder https://github.com/ctsstc</Author> | |
| <Description>Saves the MS Login Backgrounds</Description> | |
| <URI>\CTS_AE\Save MS Login Backgrounds</URI> | |
| </RegistrationInfo> | |
| <Triggers> | |
| <SessionStateChangeTrigger> | |
| <Enabled>true</Enabled> | |
| <StateChange>SessionUnlock</StateChange> | |
| <UserId>i9Beast\coder</UserId> | |
| </SessionStateChangeTrigger> | |
| </Triggers> | |
| <Principals> | |
| <Principal id="Author"> | |
| <UserId>S-1-5-21-373059960-1286789452-1330396964-1002</UserId> | |
| <LogonType>S4U</LogonType> | |
| <RunLevel>HighestAvailable</RunLevel> | |
| </Principal> | |
| </Principals> | |
| <Settings> | |
| <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy> | |
| <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries> | |
| <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries> | |
| <AllowHardTerminate>true</AllowHardTerminate> | |
| <StartWhenAvailable>false</StartWhenAvailable> | |
| <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable> | |
| <IdleSettings> | |
| <StopOnIdleEnd>true</StopOnIdleEnd> | |
| <RestartOnIdle>false</RestartOnIdle> | |
| </IdleSettings> | |
| <AllowStartOnDemand>true</AllowStartOnDemand> | |
| <Enabled>true</Enabled> | |
| <Hidden>false</Hidden> | |
| <RunOnlyIfIdle>false</RunOnlyIfIdle> | |
| <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession> | |
| <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine> | |
| <WakeToRun>false</WakeToRun> | |
| <ExecutionTimeLimit>PT1H</ExecutionTimeLimit> | |
| <Priority>7</Priority> | |
| </Settings> | |
| <Actions Context="Author"> | |
| <Exec> | |
| <Command>powershell</Command> | |
| <Arguments>-ExecutionPolicy Bypass -File "C:\Users\coder\Pictures\windows login | |
| backgrounds\_pull.ps1"</Arguments> | |
| </Exec> | |
| </Actions> | |
| </Task> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment