From d6084b0ee8d5629907914f24f50019467031719f Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 9 Aug 2024 02:59:06 +0200 Subject: [PATCH] Allow displaying a boot message --- scripts/Windows/Scripts/Registry.ps1 | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scripts/Windows/Scripts/Registry.ps1 b/scripts/Windows/Scripts/Registry.ps1 index 767d3361..178cba2d 100644 --- a/scripts/Windows/Scripts/Registry.ps1 +++ b/scripts/Windows/Scripts/Registry.ps1 @@ -16,4 +16,33 @@ $null = New-Module { [System.GC]::Collect(); & reg unload $regRootPath; } + + <# + .SYNOPSIS + Sets a message to show on the login screen. + + .PARAMETER Caption + The title of the message. + + .PARAMETER Message + The text of the message. + #> + function Set-BootMessage { + param( + [string] $Caption, + [string] $Message + ) + + $options = @{ + legalnoticecaption = $Caption; + legalnoticetext = $Message; + }; + + foreach ($key in $options.Keys) { + Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" ` + -Name $key ` + -Type "String" + -Value ($options[$key]); + } + } }