How to Deploy a Legal Notice Message upon logon of a Windows 7 or 8 Computer

A nicely formatted message can be configured on Windows 7 and 8 workstation to company data or even dynamic data based on regular software pushes to the workstations. Below are instructions on how to automate the process and regularly update the message with just two files and two "deployments" in Configuration Manager.

The Two files needed are:

  1. SetWin7LogonPromptOn.vbs
  2. SetWin7LogonPromptOFF.ps1

The SetWin7LogonPromptOn.vbs file is pushed out via Task Sequence where the 64bit redirection is turned off and the command is run from a script.

The SetWin7LogonPromptOFF.ps1 is run from a Program that is scheduled to run at Logoff.

The Legaltext message is turned on when the keys are populated with the SetWin7LogonPromptOn.vbs script. When these keys are later cleared using teh SetWin7LogonPromptOff.ps1, the Legaltext message will stop showing up.

Here is what the message looks like on a Windows 7 Computer with custom background to make the text show up better.

VB Script to Enable the Popup Legaltext message

'This process will

'1. configure a Pop Up message prior to logon via a registry key

'Set objects

Const HKEY_LOCAL_MACHINE = &H80000002

ConstOverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")

strComputer = "."

Set objReg=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

'on error resume next

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"

strValueName = "LegalNoticeCaption"

strValue = "Your Caption Here"

objReg.SetStringValueHKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"

strValueName = "LegalNoticeText"

Set WshNetwork = Wscript.CreateObject("Wscript.Network")

computername = WshNetwork.ComputerName

username = WshNetwork.UserName

'1. configure a Pop Up message prior to logon via a registry key

Configureregistrykey

wscript.quit

'*************************************************************************

'Function to configure and run the registry key

'*************************************************************************

Function Configureregistrykey

TheHeader = "The Header of Message goes here."

Paragraph1 = "The Legal Notic Text can be configured with any "chr(34) & "ASCII" & chr(34) & " characters as necessary. "

Paragraph2 = "Two registry keys are congifured to make this message show up: LegalNoticeCaption and LegalNoticText."

Paragraph3 = "Here is an example of paragraph breaks etc."

strValue = TheHeadervbCrLF _

& Paragraph1 & vbCrLFvbCrLf _

& Paragraph2 & vbCrLFvbCrLf _

& Paragraph3

'Set Registry Value

objReg.SetStringValueHKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

'Log Status of command

End Function

Powershell Script to clear the Message

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name LegalNoticeCaption -Value '' -Force

Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name LegalNoticeText -Value '' -Force

The Task Sequence to deploy the Registry Update is very simple: