Skip to content

Instantly share code, notes, and snippets.

@Hiryuto-oecu
Hiryuto-oecu / Set Random Lock Screen Wallpaper from a Folder.md
Last active January 24, 2026 09:38
Set Random Lock Screen Wallpaper from a Folder

Set Random Lock Screen Wallpaper from a Folder

This PowerShell script automatically sets a random image from a user-specified folder as the Windows lock screen wallpaper. It uses modern Windows Runtime APIs for robust performance and does not require administrator privileges.

Features

  • No Admin Rights Needed: Runs safely under a standard user account.
  • Random Image Selection: Automatically picks a random image (.jpg, .jpeg, .png) from your chosen folder.
  • Detailed Logging: Creates a log file (LockScreen_Log.txt) in your Documents folder. This file records every step of the process, making it easy to troubleshoot any issues.
  • Path Validation: Checks if the specified image folder exists before attempting to read from it.