Automatically clear Windows logon warning message

Windows Logon WarningI don’t know how widespread a problem this is, but I frequently log on to domains directly or via VPN for clients, and end up with the company’s corporate warning message on my machine on startup. Bad enough to get these from your employer, but incredibly irritating if you were just visiting!

Now, if you work for the company, they are likely using group policy to set this message and you are (probably) stuck with it, but if you are not really part of their domain, it is relatively easy to get rid of the message. You just need to run Regedit and clear the text from two strings:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\legalnoticecaption
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\legalnoticetext

I found myself doing this reasonably frequently, so I figured I should go ahead and automate the process. I wrote a very small Windows Service that just clears these settings when the machine starts, then shuts down (the service shuts down, not the machine :-). Why a service instead of just an application that runs at startup? Two reasons:

  1. Since the settings are Local Machine, the code has to run as Admin, which you get for free with a service.
  2. The service can run before Windows gets as far as the popup message, so I don’t see it even on the first run — if it ran after login, I’d see it once after each reboot. Note that it is possible that the message might appear if you are super-fast when trying to login, but I’ve not had a problem with that.

There are a few caveats/warnings:

  1. No warranty expressed or implied. Use at your own risk (and if your IT department yells at you, not my fault).
  2. There are several other ways that the popup can be set (particularly the aforementioned group policy), so if it doesn’t work, a different mechanism is probably in use.
  3. I don’t generally logout and login under different accounts, so I didn’t bother with that scenario. However, if you run the service executable with an -instant command-line it will reset the registry settings immediately, so you can either do that manually or set it to happen on login (I’ve also provided a batch file).
  4. I created batch files to install, uninstall or just reset the registry settings without having to go to a command line. The only issue is that all of those things require running as Admin (or the UAC equivalent). The batch files automatically do this using a technique stolen directly from this site, so thanks to Evan Greene for that! If you are less trusting, you can just go to a run-as-admin command prompt and run ResetLegalNotice.exe -install.
  5. I only tested under Windows 10. No reason that it shouldn’t work on earlier versions though.

Instructions:

  1. Download the zip file from here.
  2. Extract everything to some directory. I put mine in a directory called C:\Utility\ResetLegalNotice
  3. Double-click on the InstallResetService.bat file. It may or may not pop up a UAC message. Note that sometimes Windows will automatically block any downloaded items, so you might (probably) have to manually unblock the batch files and the ResetLegalNoticeService.exe program (for each file, right-click and select properties, then check the “Unblock” checkbox and hit OK).
  4. Laugh maniacally at doing your bit to subvert the overreaching bureaucrats of the world (consider this step 1 of 1,999,343,252).

If anyone wants the code, feel free to ask in comments and I’ll add it to the post.

 

 

2 Comments on “Automatically clear Windows logon warning message

  1. This is now SO much clearer to me. I particularly like the fact that you are laughing maniacally while you do it.

Leave a Reply

Your email address will not be published. Required fields are marked *

*