This is a collection of scripts used to personalize the Windows Desktop during deployment from MDT. 

All scripts are Powershell and with run with elevated rights unless stated.

There are 2 variables referenced by MDT to copy content from the MDT server to the client. %DeployRoot%, represents the root of the MDT Share, %ScriptRoot%, the scripts folder. From 'scripts' create a sub-folder named 'Custom', this will contain all subsequent content and additional scripts and commands. Create a folder for each script. 

The below images demonstrate an MDT task sequence referencing a PowerShell script and content to set the desktop background.

<#
.Synopsis
Replace the default desktop image files 

.Description

Split-path designates execution root or parent folder. Place this script in the root folder with the replacement image files. 

Replaces the default img0.jpg and img100.jpg with your new images. This takes affect for all new users logging on to the client.  

.Version

#>

#Split-Path, this is the root folder for all content
$path = Split-Path -Parent $myInvocation.MyCommand.path    

                                         

#Take Ownership of files.
takeown.exe /f C:\Windows\Web\Wallpaper\Windows\img0.jpg
takeown.exe /f C:\Windows\Web\4K\Wallpaper\Windows\*.*
takeown.exe /f C:\Windows\Web\Screen\*.*

#Grant System and Administrators Group Rights
icacls.exe C:\Windows\Web\Wallpaper\Windows\img0.jpg /Grant 'System:(F)'
icacls.exe C:\Windows\Web\Wallpaper\Windows\img0.jpg /Grant 'Administrators:(F)'
icacls.exe C:\Windows\Web\4K\Wallpaper\Windows\*.* /Grant 'System:(F)'
icacls.exe C:\Windows\Web\4K\Wallpaper\Windows\*.* /Grant 'Administrators:(F)'
icacls.exe C:\Windows\Web\Screen\*.* /Grant 'System:(F)'
icacls.exe C:\Windows\Web\Screen\*.* /Grant 'Administrators:(F)'

#Remove previous image files
Remove-Item -Path C:\Windows\Web\Wallpaper\Windows\img0.jpg 
Remove-Item -Path C:\Windows\Web\4K\Wallpaper\Windows\*.* 
Remove-Item -Path  C:\Windows\Web\Screen\*.* 

#Copy replacment files 
Copy-Item $path\img0.jpg C:\Windows\Web\Wallpaper\Windows\img0.jpg  
Copy-Item $path\img0.jpg C:\Windows\Web\4K\Wallpaper\Windows\img0.jpg   
Copy-Item $path\img100.jpg C:\Windows\Web\Screen\img100.jpg   

 

#########################################################################################

<#
.Synopsis
Change logon image

.Description

Split-path designates execution root or parent folder. Place this script in the root folder with the replacement image files. 

Changes the default Windows logon picture with custom picture. Image file backgroundDefault.jpg and script need to be placed in the parent folder.

.Version

#>

#Split-Path, this is the root folder for all content

$path = Split-Path -Parent $myInvocation.MyCommand.path  

#Sets Default Logon Background
New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background' -Name OEMBackground  -Value 1 -PropertyType DWORD

#Creates folders for default background location
New-Item -Path C:\Windows\System32\oobe\info\Backgrounds -ItemType Directory -Force

                                    

#Copy image files from $path to Backgrounds
Copy-item $path\backgroundDefault.jpg "C:\Windows\System32\oobe\info\Backgrounds" -Force 

#########################################################################################

<#
.Synopsis
No left click on Start Menu

.Description

Updates registry to prevent the launching of the admin tools from the Start Menu by left click

.Version

#>


Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\tiledatamodelsvc -Name Start -Value 4 -Force

#########################################################################################
<#
.Synopsis
Disable Right Click

.Description

Updates registry to prevent right click on the Taskbar

.Version

#>

New-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' -name NoTrayContextMenu -PropertyType DWORD -Value 1
 

 

#########################################################################################

<#

Synopsis
Update the Account Pictures Icons

.Description

 

Split-path designates execution root or parent folder. Place this script in the root folder with the replacement image files. 

 Windows 10 Account Profile location       

"C:\Programdata\Microsoft\User Account Profiles"

       

The following path was on earlier versions of Windows
"C:\Programdata\Microsoft\Default Account Pictures"

Create the following files at the correct pixel sizes stated below
user.bmp = 448 x 448
user.png = 448 x 448
user-32.png = 32 x 32
user-40.png = 40 x 40
user-48.png = 48 x 48
user-192.png = 192 x 192

.Version

#>

#Split-Path, this is the root folder for all content

$path = Split-Path -Parent $myInvocation.MyCommand.path                                              

#default location for account pictures for Windows 10
$win10Pic = "C:\ProgramData\Microsoft\User Account Pictures"

#earlier versions of Windows used the following path
$winPic = "C:\Programdata\Microsoft\Default Account Pictures"  


#test path, works for multiple versions of Windows
$tpwin10Pic = Test-Path $win10Pic
$tpwinPic = Test-Path $winPic

#User Account Pictures
if ($tpwin10Pic -eq $true){Copy-item  $path $win10Pic -Exclude *.ps1 -Force}

#Default Account Pictures
if ($tpwinPic -eq $true){Copy-item  $path $winPic -Exclude *.ps1 -Force }
      
#########################################################################################

<#
.Synopsis

Remove Taskbar Icons that are assigned during software installation

.Description

.Version

#>

Remove-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' -name "App Name" -Force -ErrorAction SilentlyContinue

#########################################################################################

<#
.Synopsis
Configure Start Menu layout

.Description

Logon to a Windows 10 client and configure the Start Menu layout, run the following powershell command

Export-StartLayout -path C:\StartMenu\StartLayout.xml

Copy the .xml file and script to the parent folder

run Import-startLayout and point to the .xml to import start menu layout

 

.Version

#>

#Split-Path, this is the root folder for all content

$path = Split-Path -Parent $myInvocation.MyCommand.path  

#Import Start Menu Configuration file

Import-startLayout -layoutPath $path\startLayout.xml -mountPath $env:systemDrive\

#########################################################################################