feat: redesign DesktopInfo to match BackInfo layout

Centered block on desktop: hostname large bold (36pt), then detail
lines in Segoe UI 14pt - user, OS (bold), CPU+RAM on one line,
IPs+domain on one line. Collects CPU count/speed, total RAM, all
IPv4 addresses, and domain/workgroup. Background #556364.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Filip Zubik 2026-03-24 05:59:20 +01:00
parent 6d5d6083ff
commit 926ca301b3
2 changed files with 176 additions and 184 deletions

View file

@ -11,7 +11,7 @@ function Write-Log {
Add-Content -Path $LogFile -Value $line -Encoding UTF8 Add-Content -Path $LogFile -Value $line -Encoding UTF8
} }
$ScriptDir = "C:\Windows\Setup\Scripts" $ScriptDir = "C:\Windows\Setup\Scripts"
$RenderScript = "$ScriptDir\DesktopInfo-Render.ps1" $RenderScript = "$ScriptDir\DesktopInfo-Render.ps1"
$BmpPath = "$ScriptDir\desktopinfo.bmp" $BmpPath = "$ScriptDir\desktopinfo.bmp"
@ -19,137 +19,133 @@ if (-not (Test-Path $ScriptDir)) {
New-Item -ItemType Directory -Path $ScriptDir -Force | Out-Null New-Item -ItemType Directory -Path $ScriptDir -Force | Out-Null
} }
# -----------------------------------------------------------------------
# Read display settings from config
# -----------------------------------------------------------------------
$fontSize = 13
$fontColor = "#FFFFFF"
$position = "bottomRight"
if ($Config -and $Config.desktopInfo) {
if ($Config.desktopInfo.fontSize) { $fontSize = [int]$Config.desktopInfo.fontSize }
if ($Config.desktopInfo.fontColor) { $fontColor = $Config.desktopInfo.fontColor }
if ($Config.desktopInfo.position) { $position = $Config.desktopInfo.position }
}
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Write the rendering script (runs on every logon as the user) # Write the rendering script (runs on every logon as the user)
# Layout: hostname (large bold, centered), then detail lines centered
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
Write-Log "Writing DesktopInfo render script to $RenderScript" -Level INFO Write-Log "Writing DesktopInfo render script to $RenderScript" -Level INFO
$renderContent = @" $renderContent = @'
# DesktopInfo-Render.ps1 # DesktopInfo-Render.ps1
# Collects system info and renders it onto the desktop wallpaper. # Collects system info and renders it centered on the desktop wallpaper.
# Runs on every user logon via Scheduled Task. # Runs on every user logon via Scheduled Task.
`$ErrorActionPreference = "Continue" $ErrorActionPreference = "Continue"
Add-Type -AssemblyName System.Drawing Add-Type -AssemblyName System.Drawing
Add-Type -TypeDefinition @' Add-Type -AssemblyName System.Windows.Forms
Add-Type -TypeDefinition @"
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
public class WallpaperApi { public class WallpaperApi {
[DllImport("user32.dll", CharSet=CharSet.Auto)] [DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni); public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
} }
'@ -ErrorAction SilentlyContinue "@ -ErrorAction SilentlyContinue
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Collect system info # Collect system info
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
`$hostname = `$env:COMPUTERNAME $hostname = $env:COMPUTERNAME
`$username = `$env:USERNAME $userDomain = $env:USERDOMAIN
`$ipAddress = (Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue | $userName = $env:USERNAME
Where-Object { `$_.IPAddress -ne "127.0.0.1" -and `$_.PrefixOrigin -ne "WellKnown" } | $loggedUser = if ($userDomain -and $userDomain -ne $hostname) { "$userDomain\$userName" } else { "$hostname\$userName" }
Select-Object -First 1).IPAddress
if (-not `$ipAddress) { `$ipAddress = "N/A" }
`$osInfo = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue $osInfo = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue
`$osName = if (`$osInfo) { `$osInfo.Caption -replace "Microsoft ", "" } else { "Windows" } $osName = if ($osInfo) { $osInfo.Caption -replace "^Microsoft\s*", "" } else { "Windows" }
`$osBuild = if (`$osInfo) { `$osInfo.BuildNumber } else { "" } $ramGB = if ($osInfo) { [math]::Round($osInfo.TotalVisibleMemorySize / 1024 / 1024, 1) } else { "?" }
# Deployment date = when script was first run, stored in registry $cpuInfo = Get-CimInstance Win32_Processor -ErrorAction SilentlyContinue | Select-Object -First 1
`$deployRegPath = "HKLM:\SOFTWARE\X9\Deployment" $cpuCount = if ($cpuInfo) { $cpuInfo.NumberOfLogicalProcessors } else { "?" }
`$deployDate = (Get-ItemProperty -Path `$deployRegPath -Name "DeployDate" -ErrorAction SilentlyContinue).DeployDate $cpuSpeed = if ($cpuInfo) { $cpuInfo.MaxClockSpeed } else { "?" }
if (-not `$deployDate) { `$deployDate = "N/A" }
$ips = (Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue |
Where-Object { $_.IPAddress -ne "127.0.0.1" -and $_.PrefixOrigin -ne "WellKnown" } |
Select-Object -ExpandProperty IPAddress) -join ", "
if (-not $ips) { $ips = "N/A" }
$csInfo = Get-CimInstance Win32_ComputerSystem -ErrorAction SilentlyContinue
$domain = if ($csInfo -and $csInfo.PartOfDomain) { $csInfo.Domain } `
elseif ($csInfo -and $csInfo.Workgroup) { $csInfo.Workgroup.ToLower() } `
else { "N/A" }
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Build info lines # Screen dimensions
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
`$lines = @( $screen = [System.Windows.Forms.Screen]::PrimaryScreen
"Computer : `$hostname" $width = if ($screen) { $screen.Bounds.Width } else { 1920 }
"User : `$username" $height = if ($screen) { $screen.Bounds.Height } else { 1080 }
"IP : `$ipAddress"
"OS : `$osName (build `$osBuild)" # -----------------------------------------------------------------------
"Deployed : `$deployDate" # Create bitmap and graphics context
# -----------------------------------------------------------------------
$bmp = New-Object System.Drawing.Bitmap($width, $height)
$g = [System.Drawing.Graphics]::FromImage($bmp)
$g.TextRenderingHint = [System.Drawing.Text.TextRenderingHint]::AntiAlias
$g.Clear([System.Drawing.ColorTranslator]::FromHtml("#556364"))
# -----------------------------------------------------------------------
# Fonts and brushes
# -----------------------------------------------------------------------
$fontName = "Segoe UI"
$fontTitle = New-Object System.Drawing.Font($fontName, 36, [System.Drawing.FontStyle]::Bold)
$fontBold = New-Object System.Drawing.Font($fontName, 14, [System.Drawing.FontStyle]::Bold)
$fontReg = New-Object System.Drawing.Font($fontName, 14, [System.Drawing.FontStyle]::Regular)
$brushWhite = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::White)
$brushGray = New-Object System.Drawing.SolidBrush([System.Drawing.ColorTranslator]::FromHtml("#C8D2D2"))
# -----------------------------------------------------------------------
# Lines: text, font, brush
# -----------------------------------------------------------------------
$texts = @(
$hostname
"Logged on user: $loggedUser"
"OS: $osName"
"CPU: $cpuCount at $cpuSpeed MHz RAM: $($ramGB)GB"
"IPv4 address: $ips Machine domain: $domain"
) )
$fonts = @( $fontTitle, $fontReg, $fontBold, $fontReg, $fontReg )
$brushes = @( $brushWhite, $brushGray, $brushGray, $brushGray, $brushGray )
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Render bitmap # Measure total block height, then center vertically
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
Add-Type -AssemblyName System.Windows.Forms -ErrorAction SilentlyContinue $lineSpacing = 8
$heights = @()
`$screen = [System.Windows.Forms.Screen]::PrimaryScreen for ($i = 0; $i -lt $texts.Count; $i++) {
`$width = if (`$screen) { `$screen.Bounds.Width } else { 1920 } $heights += [int]($g.MeasureString($texts[$i], $fonts[$i]).Height)
`$height = if (`$screen) { `$screen.Bounds.Height } else { 1080 }
`$bmp = New-Object System.Drawing.Bitmap(`$width, `$height)
`$g = [System.Drawing.Graphics]::FromImage(`$bmp)
# Background: solid accent color #223B47
`$bgColor = [System.Drawing.ColorTranslator]::FromHtml("#223B47")
`$g.Clear(`$bgColor)
# Font and colors
`$fontFamily = "Consolas"
`$fontSize = $fontSize
`$font = New-Object System.Drawing.Font(`$fontFamily, `$fontSize, [System.Drawing.FontStyle]::Regular)
`$brush = New-Object System.Drawing.SolidBrush([System.Drawing.ColorTranslator]::FromHtml("$fontColor"))
`$shadowBrush = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(180, 0, 0, 0))
# Measure text block
`$lineHeight = `$font.GetHeight(`$g) + 4
`$blockH = `$lines.Count * `$lineHeight
`$maxWidth = (`$lines | ForEach-Object { `$g.MeasureString(`$_, `$font).Width } | Measure-Object -Maximum).Maximum
# Position
`$margin = 24
`$pos = "$position"
`$x = switch -Wildcard (`$pos) {
"*Right" { `$width - `$maxWidth - `$margin }
"*Left" { `$margin }
default { `$margin }
} }
`$y = switch -Wildcard (`$pos) { $totalH = ($heights | Measure-Object -Sum).Sum + $lineSpacing * ($texts.Count - 1)
"bottom*" { `$height - `$blockH - `$margin } $currentY = [int](($height - $totalH) / 2)
"top*" { `$margin }
default { `$height - `$blockH - `$margin } # -----------------------------------------------------------------------
# Draw each line centered horizontally
# -----------------------------------------------------------------------
for ($i = 0; $i -lt $texts.Count; $i++) {
$sz = $g.MeasureString($texts[$i], $fonts[$i])
$x = [int](($width - $sz.Width) / 2)
$g.DrawString($texts[$i], $fonts[$i], $brushes[$i], [float]$x, [float]$currentY)
$currentY += $heights[$i] + $lineSpacing
} }
# Draw shadow then text $g.Dispose()
foreach (`$line in `$lines) {
`$g.DrawString(`$line, `$font, `$shadowBrush, (`$x + 1), (`$y + 1))
`$g.DrawString(`$line, `$font, `$brush, `$x, `$y)
`$y += `$lineHeight
}
`$g.Dispose() # -----------------------------------------------------------------------
# Save and set as wallpaper
# -----------------------------------------------------------------------
$bmpPath = "C:\Windows\Setup\Scripts\desktopinfo.bmp"
$bmp.Save($bmpPath, [System.Drawing.Imaging.ImageFormat]::Bmp)
$bmp.Dispose()
# Save BMP
`$bmpPath = "$BmpPath"
`$bmp.Save(`$bmpPath, [System.Drawing.Imaging.ImageFormat]::Bmp)
`$bmp.Dispose()
# Set as wallpaper
# SPI_SETDESKTOPWALLPAPER=20, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE=3 # SPI_SETDESKTOPWALLPAPER=20, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE=3
[WallpaperApi]::SystemParametersInfo(20, 0, `$bmpPath, 3) | Out-Null [WallpaperApi]::SystemParametersInfo(20, 0, $bmpPath, 3) | Out-Null
"@ '@
$renderContent | Set-Content -Path $RenderScript -Encoding UTF8 -Force $renderContent | Set-Content -Path $RenderScript -Encoding UTF8 -Force
Write-Log "Render script written" -Level OK Write-Log "Render script written" -Level OK
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Store deployment date in registry (used by render script) # Store deployment date in registry (used for reference)
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
Write-Log "Storing deployment date in registry" -Level INFO Write-Log "Storing deployment date in registry" -Level INFO
try { try {

View file

@ -11,7 +11,7 @@ function Write-Log {
Add-Content -Path $LogFile -Value $line -Encoding UTF8 Add-Content -Path $LogFile -Value $line -Encoding UTF8
} }
$ScriptDir = "C:\Windows\Setup\Scripts" $ScriptDir = "C:\Windows\Setup\Scripts"
$RenderScript = "$ScriptDir\DesktopInfo-Render.ps1" $RenderScript = "$ScriptDir\DesktopInfo-Render.ps1"
$BmpPath = "$ScriptDir\desktopinfo.bmp" $BmpPath = "$ScriptDir\desktopinfo.bmp"
@ -19,137 +19,133 @@ if (-not (Test-Path $ScriptDir)) {
New-Item -ItemType Directory -Path $ScriptDir -Force | Out-Null New-Item -ItemType Directory -Path $ScriptDir -Force | Out-Null
} }
# -----------------------------------------------------------------------
# Read display settings from config
# -----------------------------------------------------------------------
$fontSize = 13
$fontColor = "#FFFFFF"
$position = "bottomRight"
if ($Config -and $Config.desktopInfo) {
if ($Config.desktopInfo.fontSize) { $fontSize = [int]$Config.desktopInfo.fontSize }
if ($Config.desktopInfo.fontColor) { $fontColor = $Config.desktopInfo.fontColor }
if ($Config.desktopInfo.position) { $position = $Config.desktopInfo.position }
}
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Write the rendering script (runs on every logon as the user) # Write the rendering script (runs on every logon as the user)
# Layout: hostname (large bold, centered), then detail lines centered
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
Write-Log "Writing DesktopInfo render script to $RenderScript" -Level INFO Write-Log "Writing DesktopInfo render script to $RenderScript" -Level INFO
$renderContent = @" $renderContent = @'
# DesktopInfo-Render.ps1 # DesktopInfo-Render.ps1
# Collects system info and renders it onto the desktop wallpaper. # Collects system info and renders it centered on the desktop wallpaper.
# Runs on every user logon via Scheduled Task. # Runs on every user logon via Scheduled Task.
`$ErrorActionPreference = "Continue" $ErrorActionPreference = "Continue"
Add-Type -AssemblyName System.Drawing Add-Type -AssemblyName System.Drawing
Add-Type -TypeDefinition @' Add-Type -AssemblyName System.Windows.Forms
Add-Type -TypeDefinition @"
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
public class WallpaperApi { public class WallpaperApi {
[DllImport("user32.dll", CharSet=CharSet.Auto)] [DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni); public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
} }
'@ -ErrorAction SilentlyContinue "@ -ErrorAction SilentlyContinue
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Collect system info # Collect system info
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
`$hostname = `$env:COMPUTERNAME $hostname = $env:COMPUTERNAME
`$username = `$env:USERNAME $userDomain = $env:USERDOMAIN
`$ipAddress = (Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue | $userName = $env:USERNAME
Where-Object { `$_.IPAddress -ne "127.0.0.1" -and `$_.PrefixOrigin -ne "WellKnown" } | $loggedUser = if ($userDomain -and $userDomain -ne $hostname) { "$userDomain\$userName" } else { "$hostname\$userName" }
Select-Object -First 1).IPAddress
if (-not `$ipAddress) { `$ipAddress = "N/A" }
`$osInfo = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue $osInfo = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue
`$osName = if (`$osInfo) { `$osInfo.Caption -replace "Microsoft ", "" } else { "Windows" } $osName = if ($osInfo) { $osInfo.Caption -replace "^Microsoft\s*", "" } else { "Windows" }
`$osBuild = if (`$osInfo) { `$osInfo.BuildNumber } else { "" } $ramGB = if ($osInfo) { [math]::Round($osInfo.TotalVisibleMemorySize / 1024 / 1024, 1) } else { "?" }
# Deployment date = when script was first run, stored in registry $cpuInfo = Get-CimInstance Win32_Processor -ErrorAction SilentlyContinue | Select-Object -First 1
`$deployRegPath = "HKLM:\SOFTWARE\X9\Deployment" $cpuCount = if ($cpuInfo) { $cpuInfo.NumberOfLogicalProcessors } else { "?" }
`$deployDate = (Get-ItemProperty -Path `$deployRegPath -Name "DeployDate" -ErrorAction SilentlyContinue).DeployDate $cpuSpeed = if ($cpuInfo) { $cpuInfo.MaxClockSpeed } else { "?" }
if (-not `$deployDate) { `$deployDate = "N/A" }
$ips = (Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue |
Where-Object { $_.IPAddress -ne "127.0.0.1" -and $_.PrefixOrigin -ne "WellKnown" } |
Select-Object -ExpandProperty IPAddress) -join ", "
if (-not $ips) { $ips = "N/A" }
$csInfo = Get-CimInstance Win32_ComputerSystem -ErrorAction SilentlyContinue
$domain = if ($csInfo -and $csInfo.PartOfDomain) { $csInfo.Domain } `
elseif ($csInfo -and $csInfo.Workgroup) { $csInfo.Workgroup.ToLower() } `
else { "N/A" }
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Build info lines # Screen dimensions
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
`$lines = @( $screen = [System.Windows.Forms.Screen]::PrimaryScreen
"Computer : `$hostname" $width = if ($screen) { $screen.Bounds.Width } else { 1920 }
"User : `$username" $height = if ($screen) { $screen.Bounds.Height } else { 1080 }
"IP : `$ipAddress"
"OS : `$osName (build `$osBuild)" # -----------------------------------------------------------------------
"Deployed : `$deployDate" # Create bitmap and graphics context
# -----------------------------------------------------------------------
$bmp = New-Object System.Drawing.Bitmap($width, $height)
$g = [System.Drawing.Graphics]::FromImage($bmp)
$g.TextRenderingHint = [System.Drawing.Text.TextRenderingHint]::AntiAlias
$g.Clear([System.Drawing.ColorTranslator]::FromHtml("#556364"))
# -----------------------------------------------------------------------
# Fonts and brushes
# -----------------------------------------------------------------------
$fontName = "Segoe UI"
$fontTitle = New-Object System.Drawing.Font($fontName, 36, [System.Drawing.FontStyle]::Bold)
$fontBold = New-Object System.Drawing.Font($fontName, 14, [System.Drawing.FontStyle]::Bold)
$fontReg = New-Object System.Drawing.Font($fontName, 14, [System.Drawing.FontStyle]::Regular)
$brushWhite = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::White)
$brushGray = New-Object System.Drawing.SolidBrush([System.Drawing.ColorTranslator]::FromHtml("#C8D2D2"))
# -----------------------------------------------------------------------
# Lines: text, font, brush
# -----------------------------------------------------------------------
$texts = @(
$hostname
"Logged on user: $loggedUser"
"OS: $osName"
"CPU: $cpuCount at $cpuSpeed MHz RAM: $($ramGB)GB"
"IPv4 address: $ips Machine domain: $domain"
) )
$fonts = @( $fontTitle, $fontReg, $fontBold, $fontReg, $fontReg )
$brushes = @( $brushWhite, $brushGray, $brushGray, $brushGray, $brushGray )
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Render bitmap # Measure total block height, then center vertically
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
Add-Type -AssemblyName System.Windows.Forms -ErrorAction SilentlyContinue $lineSpacing = 8
$heights = @()
`$screen = [System.Windows.Forms.Screen]::PrimaryScreen for ($i = 0; $i -lt $texts.Count; $i++) {
`$width = if (`$screen) { `$screen.Bounds.Width } else { 1920 } $heights += [int]($g.MeasureString($texts[$i], $fonts[$i]).Height)
`$height = if (`$screen) { `$screen.Bounds.Height } else { 1080 }
`$bmp = New-Object System.Drawing.Bitmap(`$width, `$height)
`$g = [System.Drawing.Graphics]::FromImage(`$bmp)
# Background: solid accent color #223B47
`$bgColor = [System.Drawing.ColorTranslator]::FromHtml("#223B47")
`$g.Clear(`$bgColor)
# Font and colors
`$fontFamily = "Consolas"
`$fontSize = $fontSize
`$font = New-Object System.Drawing.Font(`$fontFamily, `$fontSize, [System.Drawing.FontStyle]::Regular)
`$brush = New-Object System.Drawing.SolidBrush([System.Drawing.ColorTranslator]::FromHtml("$fontColor"))
`$shadowBrush = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(180, 0, 0, 0))
# Measure text block
`$lineHeight = `$font.GetHeight(`$g) + 4
`$blockH = `$lines.Count * `$lineHeight
`$maxWidth = (`$lines | ForEach-Object { `$g.MeasureString(`$_, `$font).Width } | Measure-Object -Maximum).Maximum
# Position
`$margin = 24
`$pos = "$position"
`$x = switch -Wildcard (`$pos) {
"*Right" { `$width - `$maxWidth - `$margin }
"*Left" { `$margin }
default { `$margin }
} }
`$y = switch -Wildcard (`$pos) { $totalH = ($heights | Measure-Object -Sum).Sum + $lineSpacing * ($texts.Count - 1)
"bottom*" { `$height - `$blockH - `$margin } $currentY = [int](($height - $totalH) / 2)
"top*" { `$margin }
default { `$height - `$blockH - `$margin } # -----------------------------------------------------------------------
# Draw each line centered horizontally
# -----------------------------------------------------------------------
for ($i = 0; $i -lt $texts.Count; $i++) {
$sz = $g.MeasureString($texts[$i], $fonts[$i])
$x = [int](($width - $sz.Width) / 2)
$g.DrawString($texts[$i], $fonts[$i], $brushes[$i], [float]$x, [float]$currentY)
$currentY += $heights[$i] + $lineSpacing
} }
# Draw shadow then text $g.Dispose()
foreach (`$line in `$lines) {
`$g.DrawString(`$line, `$font, `$shadowBrush, (`$x + 1), (`$y + 1))
`$g.DrawString(`$line, `$font, `$brush, `$x, `$y)
`$y += `$lineHeight
}
`$g.Dispose() # -----------------------------------------------------------------------
# Save and set as wallpaper
# -----------------------------------------------------------------------
$bmpPath = "C:\Windows\Setup\Scripts\desktopinfo.bmp"
$bmp.Save($bmpPath, [System.Drawing.Imaging.ImageFormat]::Bmp)
$bmp.Dispose()
# Save BMP
`$bmpPath = "$BmpPath"
`$bmp.Save(`$bmpPath, [System.Drawing.Imaging.ImageFormat]::Bmp)
`$bmp.Dispose()
# Set as wallpaper
# SPI_SETDESKTOPWALLPAPER=20, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE=3 # SPI_SETDESKTOPWALLPAPER=20, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE=3
[WallpaperApi]::SystemParametersInfo(20, 0, `$bmpPath, 3) | Out-Null [WallpaperApi]::SystemParametersInfo(20, 0, $bmpPath, 3) | Out-Null
"@ '@
$renderContent | Set-Content -Path $RenderScript -Encoding UTF8 -Force $renderContent | Set-Content -Path $RenderScript -Encoding UTF8 -Force
Write-Log "Render script written" -Level OK Write-Log "Render script written" -Level OK
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Store deployment date in registry (used by render script) # Store deployment date in registry (used for reference)
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
Write-Log "Storing deployment date in registry" -Level INFO Write-Log "Storing deployment date in registry" -Level INFO
try { try {