-
Notifications
You must be signed in to change notification settings - Fork 1
/
ComputerBranding.ps1
72 lines (61 loc) · 3.07 KB
/
ComputerBranding.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<#
.SYNOPSIS
Set Wallpaper and LockScreen in Windows 10 Enterprise downloading file from a site. (In my case Azure Blob).
.DESCRIPTION
This script will replace The Lockdown and Desktop and images.
Follow Per Larsen's guide on how to create Azure Blob & get the shared access signature.
https://osddeployment.dk/2019/04/14/how-to-set-windows-10-lock-screen-and-background-picture-with-intune/
@PerLarsen1975
.NOTES
Version: 1.0
Author: Bruce Sa
Twitter: @BruceSaaaa
Creation date: 04-15-2019
.LINK
https://github.com/brucesa85/Powershell-Scripts
#>
#Set your image location ex: "https://mysite.blob.core.windows.net/w"
$LockScreenSource = "https://picturelink"
$BackgroundSource = "https://picturelink"
if (-not [string]::IsNullOrWhiteSpace($LogPath)) {
Start-Transcript -Path "$($LogPath)\$($env:COMPUTERNAME).log" | Out-Null
}
$ErrorActionPreference = "Stop"
$RegKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP"
$DesktopPath = "DesktopImagePath"
$DesktopStatus = "DesktopImageStatus"
$DesktopUrl = "DesktopImageUrl"
$LockScreenPath = "LockScreenImagePath"
$LockScreenStatus = "LockScreenImageStatus"
$LockScreenUrl = "LockScreenImageUrl"
$StatusValue = "1"
$DesktopImageValue = "C:\Windows\System32\oobe\Desktop.jpg"
$LockScreenImageValue = "C:\Windows\System32\oobe\LockScreen.jpg"
if (!$LockScreenSource -and !$BackgroundSource)
{
Write-Host "Either LockScreenSource or BackgroundSource must has a value."
}
else
{
if(!(Test-Path $RegKeyPath)) {
Write-Host "Creating registry path $($RegKeyPath)."
New-Item -Path $RegKeyPath -Force | Out-Null
}
if ($LockScreenSource) {
Write-Host "Copy Lock Screen image from $($LockScreenSource) to $($LockScreenImageValue)."
(New-Object System.Net.WebClient).DownloadFile($LockScreenSource, "$LockScreenImageValue")
Write-Host "Creating registry entries for Lock Screen"
New-ItemProperty -Path $RegKeyPath -Name $LockScreenStatus -Value $StatusValue -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $LockScreenPath -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $LockScreenUrl -Value $LockScreenImageValue -PropertyType STRING -Force | Out-Null
}
if ($BackgroundSource) {
Write-Host "Copy Desktop Background image from $($BackgroundSource) to $($DesktopImageValue)."
(New-Object System.Net.WebClient).DownloadFile($BackgroundSource, "$DesktopImageValue")
Write-Host "Creating registry entries for Desktop Background"
New-ItemProperty -Path $RegKeyPath -Name $DesktopStatus -Value $StatusValue -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $DesktopPath -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
New-ItemProperty -Path $RegKeyPath -Name $DesktopUrl -Value $DesktopImageValue -PropertyType STRING -Force | Out-Null
}
}
if (-not [string]::IsNullOrWhiteSpace($LogPath)){Stop-Transcript}