-
Notifications
You must be signed in to change notification settings - Fork 0
/
Script.ps1
24 lines (22 loc) · 869 Bytes
/
Script.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$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\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 1920 -or $height -lt 500) {
Remove-Item $_
}
}
}