Category filter
Script to configure interactive logon message on Windows
An interactive logon message specifies a text message shown to the user when they sign in. It can be used as a security measure by organizations to warn/notify users about anything. These banners typically contain legal notices or disclaimers that inform users about appropriate system usage and privacy expectations. By agreeing to the terms and conditions presented in the logon messages, users acknowledge that they understand and accept the information presented in the banner before proceeding to log in. By configuring the Group Policy Objects (GPOs) on Windows devices, an interactive logon message can be set to display before user login. IT administrators can deploy the following script to set an interactive logon message on a fleet of Windows devices using Hexnode’s Execute Custom Script remote action.
PowerShell script
The following PowerShell script helps to configure Windows registry keys to set an interactive logon message on Windows devices.
1 2 3 4 5 6 7 8 9 10 11 12 |
$MessageText = @" “Enter your text here” "@ $MessageTitle = "Enter a Title for the text $MessageTextPolicyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" $MessageTitlePolicyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" Set-ItemProperty -Path $MessageTextPolicyPath -Name legalnoticetext -Value $MessageText Set-ItemProperty -Path $MessageTitlePolicyPath -Name legalnoticecaption -Value $MessageTitle |
Before deploying the script, write the information to be displayed in place of “Enter your text here” in the script. You can also set up a title for your instructions by replacing “Enter a Title for the text” in the script.
The script uses the Set-ItemProperty cmdlet of PowerShell to edit policies in the Windows registry related to the interactive logon message. It modifies the values of the ‘legalnoticetext’ and ‘legalnoticecaption’ registry keys located at ‘HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System’.
These registry keys are responsible for setting up an interactive message on the login window, which will be displayed to users when they attempt to log on to the Windows device.
What happens at the device end?
Deploying the above script will display an interactive message to all users when logging in to the device. Users must click ‘OK’ before proceeding to log in to the device.