-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaptureSpotlightImage.ps1
More file actions
23 lines (19 loc) · 975 Bytes
/
captureSpotlightImage.ps1
File metadata and controls
23 lines (19 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Let's use CimInstance instead, WmiObject is getting depreciated
$mysid = Get-CimInstance Win32_UserAccount -Filter "name='$($env:USERNAME)'" | Select -ExpandProperty sid
$HKs = Get-ChildItem -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Creative\$mySid | Get-ItemProperty -Name LandscapeImage
$LandscapeImageLoc = $HKs | select -ExpandProperty LandscapeImage
$DestinationPath = "c:\users\$env:USERNAME\WallPapers"
# Make sure destination path exists
If (-not (Test-Path -Path $DestinationPath))
{
$null = New-Item -Path $DestinationPath -ItemType Directory
}
ForEach ($Image in $LandscapeImageLoc)
{
# Pull just the file name
$FileName = Split-Path -Path $Image -Leaf
# Create full destination path and add .jpg to the end of the filename
$Destination = Join-Path -Path $DestinationPath -ChildPath "$FileName.jpg"
# Perform the copy
Copy-Item -Path $Image -Destination $Destination
}