Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 2.29 KB

README.md

File metadata and controls

60 lines (39 loc) · 2.29 KB

Win10LockScreenScraper

Scrapes all the great Windows Spotlight images used as lock screen images.

The images will be saved to a folder on your desktop named LockScreenPics.

Usage

Execution policy

In order to use this script, you'll need to adjust your execution policy. By default, the execution policy is set to Restricted, which means that PowerShell can only be used in interactive mode (i.e. no scripts).

To run this script, you'll need to set your execution policy to Unrestricted. If that's a little too much, you can set it to AllSigned. However, you'll need to sign the script for it to be allowed. I'll get some instructions on that up sometime.

You can set the execution policy via:

  1. Click the Start button
  2. Type in PowerShell
  3. Right-click on Windows PowerShell and click on Run as administrator
  4. Run: Set-ExecutionPolicy Unrestricted
  5. Answer Y

Running it ad-hoc

powershell C:\Path\To\Win10LockScreenScraper.ps1

Running automatically via the Task Scheduler

Creating the task

The following command will schedule the script to run daily at 1 PM:

schtasks ^
/Create ^
/RU %YOUR_USERNAME% ^
/RP "*" ^
/SC DAILY ^
/TN Win10LockScreenScraper ^
/TR "PowerShell C:\Path\To\Win10LockScreenScraper.ps1" ^
/ST 13:00

Note: The argument for /RP "*" means that you'll be prompted for your password before the task is scheduled. This keeps you from having it in your cmd history.

Note: If you're using a Microsoft account to log in, your username will be your account's email address.

Test out the task

To make sure the task was successfully scheduled, you can run the task via:

schtasks /Run /TN Win10LockScreenScraper

Deleting the task

schtasks /Delete /TN Win10LockScreenScraper

TODO

  • I've noticed that certain lock screen images contain metadata about the images (name, etc). We can base the filename off of that.

  • The destination directory is currently hardcoded. We should allow the user to configure that via an environment variable.

  • Instructions on self-signing the script, so we don't have to use the Unrestricted execution policy.

Why PowerShell?

Why not? It's already available on Windows 10. No need to install any other interpreters, runtimes, etc. Plus, I wanted to play around with it :)