Skip to content

Instantly share code, notes, and snippets.

@ygra
Created November 16, 2016 10:05
Show Gist options
  • Save ygra/eb379c339bae1914506f354ce5638f9e to your computer and use it in GitHub Desktop.
Save ygra/eb379c339bae1914506f354ce5638f9e to your computer and use it in GitHub Desktop.
A small PowerShell script to save Windows 10 lock screen images to a more accessible location.
$files = gci $Env:LocalAppData\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets |
where Length -gt 1kb
if ($files) {
$shell = New-Object -ComObject Shell.Application
$folder = "$Env:USERPROFILE\Pictures\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 500 -or $height -lt 500) {
Remove-Item $_
}
}
}
@ChavezTheresa
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment