<#
Solution: Hydration 
Purpose: Configure - Wallpaper
Version: 1.2 -  Juin 2015 
Author - Jérôme Bezet-Torres
 
#>

# Determine where to do the logging 
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment 
$logPath = $tsenv.Value("LogPath") 
$logFile = "$logPath\$($myInvocation.MyCommand).log" 

# Start the logging 
Start-Transcript $logFile 
Write-Host "Logging to $logFile"

$LocalPath = "C:\wallpaper\"
New-Item -ItemType Directory -Force -Path $LocalPath
Copy-Item "D:\Deploy\Applications\Configure - Wallpaper\source\wallpaper.jpg" $LocalPath


Set-ItemProperty -path 'HKCU:\Control Panel\Desktop\' -name wallpaper -value "C:\Wallpaper\wallpaper.jpg"


Rundll32.exe user32.dll, UpdatePerUserSystemParameters

# Stop logging 
Stop-Transcript
