header image

Windows 7/Vista – Network Location Monitor

The story

This utility started as a result of experiencing weird and annoying glitch in Windows 7/Vista. Every time my home PC lost internet connection for some reason (even momentarily), its network location changed from “Private” to “Public”. Seemed like Windows didn’t recognize the connection, since its name also changed to “Unidentified network”.

I often use Remote Desktop to connect to the home PC, so this was very annoying: Public network location makes remote connections impossible. After extensive googling I’ve found no solution that was working for me. Maybe it’s Windows, maybe my router, maybe the ISP, I don’t know. But I needed to do something about it.

I could try to debug the issue but I’m rather lazy when it comes to such things. So I wrote a simple service that monitors changes to network connections. If any of configured connections’ location changes from Private, the service sets it to Private again. Simple, easy and most important – it works.


Network Location Monitor is written in C# 4.0 and requires .NET Framework 4 to run. If you don’t have it, get it here:

First, run install.bat as an administrator. It installs the service (NetLocationMonitor). Then, run start.bat (also as admin) to start the service. That’s it, service is set to autostart, so it starts with Windows. stop.bat stops the service and uninstall.bat, well, uninstalls it.

WARNING: only start the service if your machine is connected to a trusted network! NetLocationMonitor will set any new connections to Private!

Technical details

Service name is NetLocationMonitor. It runs as LocalSystem – unfortunately it’s needed for the access rights to change network type. It writes an entry to Application event log whenever new network is being detected and corrected.

NetTest project in the sources is an artifact of an earlier version, when NLM only monitored specific networks for changes. That didn’t really work, since when the glitch happens, a new network is being added – the old one doesn’t change.


Network Location Monitor is placed in the public domain.


Network Location Monitor

~ by omeg on July 26, 2011.

code, utility, windows desktop

Leave a Reply