Allow displaying a boot message

This commit is contained in:
Manuel Thalmann 2024-08-09 02:59:06 +02:00
parent c631882854
commit 849d8387cc

View file

@ -16,4 +16,33 @@ $null = New-Module {
[System.GC]::Collect(); [System.GC]::Collect();
& reg unload $regRootPath; & 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]);
}
}
} }