Network Watchdog dashboard showing a healthy system, with a PowerShell console, real-time process and network monitoring charts, security indicators, and a Windows system tray notification.

From a Script to a Service: How LightingWatchdog Grew Into Network Watchdog

TL;DR: How a One-Service Script Became a Windows Service

A PowerShell watchdog built to babysit one leaky ASUS service grew, in a matter of weeks, into Network Watchdog: a Windows service with a tray dashboard that protects every process on the PC. This is the story behind it, with the reasons, the releases, the day it restarted my own browser, and the way I keep it honest today.

Short on time? Jump to what it does and who it is for, or open the project page.

How it all started: The Night I Fought LightingService (And Built a Watchdog to Win). This is the second part of the series, so if you have not read the first article, start there.

The Window I Was Not Allowed to Close

For a few weeks, one PowerShell window on my desktop had a very simple job and two very simple rules.

Do not close me. And do not click inside me.

The first rule was obvious. The window was the watchdog. Close it, and ASUS LightingService was free to leak sockets again, one quiet drip at a time. The second rule I learned the hard way. In a classic console window, selecting a bit of text can pause the running program until you press a key. A watchdog that a mouse click can put to sleep is asleep exactly when you need it.

A couple of weeks after I created its GitHub repository, I wrote down the whole saga in the first article, the story of the LightingService.exe socket leak: a service that kept opening sockets it never closed until Windows ran out of buffer space and the network died with ERR_NO_BUFFER_SPACE, and a PowerShell toolkit called LightingWatchdog that restarts the service before that happens.

It worked. That was the problem. Things that work get promoted.

When a Console Window Stops Being Enough

A protection that needs a human to keep a window open is not really protection. It is a pet that needs to be walked.

The day after I published the first article, a reader left a comment on the Ukrainian version. His verdict: my watchdog was a crutch. It did not remove the leak, it only restarted the service when things got bad, and it burned resources on a permanent polling loop while doing so.

He was half right, which is the most useful kind of criticism. The leak lived in closed vendor software, and I could not fix it from outside. But the polling part hurt, because I had already noticed it myself:

  • Polling has a price. The script kept asking Windows the same questions with Get-NetTCPConnection and WMI. Each question was cheap. Thousands of them were not: idle CPU and disk I/O were higher than I wanted from a tool whose job is to do nothing most of the time. And between two polls there was always a gap where a leak could grow unseen.
  • The console could freeze. That is the click-inside-me rule from above.
  • A PowerShell quirk bit back. In the quarantine logic, when only one restart timestamp remained in the window, PowerShell collapsed the list into a single date, and recording the next restart threw an op_Addition error. Version 2.7.2 of the toolkit fixed it by forcing the history to stay an array.
  • I wanted no window at all. A Windows service runs headless in the background, in Session 0, the isolated session where services live. Nothing to close, nothing to click.

That comment stuck with me. I replied that the script was only a temporary solution and that the next version would be written in C# and use Event Tracing for Windows (ETW) instead of polling. I even gave it a number: v3.0. Putting a version number on a promise, on a public page, is a dangerous habit. Remember that number, because it comes back later.

So I did not keep adding features to the script. I split the idea in two:

  • LightingWatchdog: the PowerShell toolkit. No installation, started with Start-LightingWatchdog.bat, built solely for LightingService, still maintained (current version v2.7.4). LightingWatchdog on GitHub
  • Network Watchdog: the C# application. A Windows service (NetworkWatchdogService), a tray dashboard (NetworkWatchdog.TrayApp), an installer, and general protection for every process, not only ASUS. Network Watchdog on GitHub

Same idea, different body.

Ten Days of Experiments

The first C# release, 1.0.0 (the numbering changed later, more on that below), was a bare .NET 8 Worker Service that listened to socket events through ETW (the Microsoft-Windows-Winsock-AFD provider) and still asked netstat for a starting baseline.

Then came the part I am fondest of. Nothing about the app was planned: I was discovering, one experiment at a time, how to contain the leak and how to make the watchdog more stable, safer and lighter on resources. Each idea was quick to try and quick to ship, so in the ten days that followed I published twelve releases, 1.0.0 to 1.5.3, four of them in a single day.

The changelog reads like the diary of a developer learning in public, which is exactly what I was: it was my first big project, and I learned from every hit and miss:

  • 21/09/2026: my ETW counter was inflated by three per connection, because I was counting the create, bind and connect events of the same socket. A leak detector that exaggerates is only half a detector.
  • 23/09/2026: the tray app arrived, and with it the traffic light: green, orange, red.
  • 24/09/2026: universal monitoring of every process, a live dashboard, and named-pipe communication between the service and the tray.
  • 26/09/2026: the tray app itself crashed after about two hours of continuous operation, because it was leaking GDI handles. Yes, my leak watchdog leaked. I fixed it and added a guardrail that logs a warning when its own handle count gets high.
  • 28/09/2026: netstat.exe was replaced with a native Windows call, plus a round of security hardening for the pipes and the restart logic.

And here is the same leak, written down by a service instead of by me:

Mitigation log with LightingService entries on 25/09, each exceeding about 1,514 sockets
The mitigation log from the same days. In that stretch the leak reached about 1,514 sockets and was cleared again roughly every 51 minutes.

The default threshold in those builds was 1,500 sockets. Remember that number too.

The Detector That Could Not See the Leak

A few days later, version 1.6.0 brought an installer and an auto-updater, and it also contained the most embarrassing line in my changelog.

The service had two sources of truth. ETW streamed socket events in real time. For the baseline, the count of what is really open, I had replaced netstat with the native Windows call GetExtendedTcpTable. Fast, elegant, and, as I discovered, blind to exactly the kind of socket that LightingService leaks: sockets that are reserved with bind() and never connected. It can be compared to guests who booked a room in a hotel and never checked in.

When I switched the baseline to the authoritative CIM/NSI provider, the same one behind PowerShell’s Get-NetTCPConnection, my changelog says it instantly exposed thousands of previously invisible leaked sockets. The detector had been blind to the very leak it was built for.

Today the arrangement is simple. Every 15 seconds Network Watchdog reads the socket table through CIM/NSI. ETW keeps the count current between those checks. The old native call stays only as a fallback. The same release lowered the default threshold from 1,500 to 1,000 sockets and shortened the baseline interval from 60 to 15 seconds, so that a climbing leak is caught up to 45 seconds sooner.

The short version of this twist is in Update 2 of the first article. This is the long one.

The Day It Restarted My Own Browser

Network Watchdog had learned to count. It had not learned to judge.

One evening it found a process above the threshold, which on my PC was temporarily set to 200 sockets for the test purposes, the lowest value the dashboard allows. The process was my browser, brave, with 210 sockets. The watchdog did exactly what it had been taught.

It was not the last time. The Windows download service DoSvc got the same treatment the very next day (235 sockets) and once more the day after that (213 sockets).

Historical archive listing brave on 30/10 and DoSvc on 31/10 and 01/11 among many LightingService entries
The Historical Archive tab. Among the long run of LightingService entries, one brave and two DoSvc rows.

Look closer at that log and you can see the leak’s rhythm: the large LightingService mitigations, between roughly 1,100 and 1,300 sockets, came about once an hour.

Nothing was broken. The counting was right. The judgement was missing, and the reason was simple: in the early builds, the whitelist was empty.

Settings tab of the 25/09/2026 build with a threshold slider at 1513 and an empty whitelist
The settings tab of an early build: a threshold of 1,513 and nobody on the guest list.

Network Watchdog had carried a whitelist since version 1.4.0, and version 1.7.0 had added a quarantine, which suspends automatic restarts after three attempts in 60 minutes, and a 120-second cooldown. But a cooldown limits how often a watchdog bites, not whom. So the whitelist grew: browsers, a few popular programs and, of course, DoSvc.

Settings tab with threshold 200 and a whitelist of steam, Discord, msedge, chrome, brave, firefox and DoSvc
My whitelist at that point. Notice who is on it.

Here is the part that made me smile and wince at the same time. Adding DoSvc did nothing, because DoSvc is not a process. It is a Windows service that lives inside a shared svchost.exe. The watchdog compared its whitelist with the process name (svchost), while its logs showed the service name (DoSvc), so the entry looked right everywhere except at the one place that decided. The service name was only resolved later, in the restart pipeline.

The clue was the rhythm. The restarts came exactly one cooldown, two minutes, apart. That pointed at the check itself, not at loading or saving the list.

The fix, version 1.9.2, rests on one idea: match every identity of a process, meaning its image name and the names of all the services it hosts. If any of them is whitelisted, the whole shared host is left alone. My first draft of the fix cached one service name per process, last one wins, which would have been wrong for exactly the shared hosts it was meant for.

Testing it meant not waiting for the real trigger, because the real service was idle. So I wrote a tiny Windows service whose service name differs from its process name and which holds 300 loopback sockets. Not whitelisted, it was restarted. The real DoSvc host, with 427 connections, was skipped and logged once. The hotfix went out the same day.

And the changelog keeps its own honest list of what is still missing. When a non-whitelisted service is restarted, its host process is ended together with everything else it hosts. The dashboard still shows svchost instead of the hosted service name. Both are planned for 1.10.0, together with a list of protected defaults.

There is one more lesson hiding in the logs: other services, a VPN service for example, can look like leaks at a low threshold.That is why detection based on growth, not only on a fixed number, is on the roadmap too.

A watchdog that bites its owner is not a guard. It is a pet with a problem. I would rather print that in a changelog than discover it in a support thread.

The Day I Renumbered My Own Software

Remember the v3.0 I promised the reader? The first C# build really was numbered 3.0.0, because it was developed inside the PowerShell repository and carried that repository’s numbers. I had been giving the child its parent’s surname.

It kept that surname until version 3.9.0 (the evidence build). Then it became obvious that two different programs with one shared numbering was a lie waiting to confuse someone. So I split them:

  • 31/10/2026: PowerShell v2.7.4 tagged, and the new repository DiegoUA/NetworkWatchdog created.
  • 02/11/2026: Network Watchdog 1.9.1, the first independent release. Releases 3.0.0 to 3.9.0 became 1.0.0 to 1.9.0; the old releases and tags were removed from the PowerShell repository, and the old numbers live on in the changelog for history. The release also fixed an installer that put its shortcut in a Start Menu folder literally named “(Default)”. Even a clean start has its comedy.
  • 13/11/2026: version 1.9.2, the whitelist hotfix above.
  • 19/11/2026: version 1.9.3, a hotfix for the tray app only.

The 1.9.2 hotfix taught me one more thing about versions: the version number lived in eight lines across five files, and the hotfix needed all of them. A single source of truth is on the plan.

Today LightingWatchdog has its own line (v2.7.4), and Network Watchdog is at 1.9.3. One screenshot further down was taken before the split, and its version label still carries the old 3.9.0. I left it as it is. It is history.

Evidence, Not Assumptions: How Network Watchdog Is Developed Today

The method

Every behaviour Network Watchdog relies on gets tested and logged and I number my experiments as “trials”, so that when I say “this works” there is a line somewhere that says how I know. Each release gets one report, and one status file is the single source of truth. Documentation is updated to match the code, and I do not delete my own content to make the story tidier.

I build this with a mix of tools, AI assistants among them. I do not hide it, and I do not think there is anything to hide. Part of the job today is to keep learning, follow how the tools change and know how to work with them, and then to check every claim against the code and the logs anyway.

The evidence button

The Network Watchdog dashboard has a Collect Evidence button.. One click bundles socket tables, kernel counters, event logs and a memory dump of the process, with a README_FOR_RD.txt that explains every file, so that a vendor’s engineers can reproduce a problem instead of taking my word for it.

Warning dialog: Process memory can contain passwords, tokens and personal data
The warning before every collection. A memory dump can contain things you would not post on a blog.

There are exactly two triggers: that button, and an opt-in setting that captures evidence automatically before a restart, which is off by default because a full memory dump can take hundreds of megabytes.

That second trigger has its own embarrassing history. In version 1.8.0 the evidence was captured after the kill. A process that has already been killed is a poor witness, like photographing a crime scene after cleaning it. Version 1.9.0 moved the capture into the service, before the kill.

I have since scanned the three evidence cases I collected. The structured files (JSON, CSV, text) had no hits, but each memory dump contained a few strings matching credential patterns.

The patterns are loose, so they may be false positives, but I cannot rule any of them out. A dump holds whatever the process had in memory, so I never call a dump credential-free, and that is why the dialog above exists.

Planned, not shipped yet: refusing dumps of browsers and password managers, the Standard dump mode by default for manual captures, redacted command lines in the process table, and a sentence about all this in the privacy notice.

What ASUS did

ASUS announced the 6.7 series of Armoury Crate on its ROG forum in October, and Update 2 of the first article has the details of what I saw afterwards. Here is only the part it skips: I installed that update by mistake, because I wanted the leak to live a little longer so that I could keep testing my application. The last LightingService entry in my Historical Archive is dated 31/10/2026 at 16:23:57, the day I installed the update. That is one PC and a short time, an observation and not a proof.

I also shared my findings publicly in my LightingWatchdog post on Reddit, where one reader’s reply about the Aura wallpaper, covered in Update 2, added a clue I had not seen.

Privacy by Design, and One Thing I Still Have to Fix

A tool that can read process memory, like Network Watchdog, had better be boring about where the data goes.

  • The only code in Network Watchdog that touches the internet is the GitHub auto-updater. I searched the code for other network classes and found nothing.
  • The only other outgoing traffic is an optional syslog message over UDP, off by default.
  • Evidence, including memory dumps, is stored in a folder that only Administrators and the system account can read. Exporting a memory dump asks for confirmation first, and the dashboard asks for elevation because of that restricted folder.
Access Denied dialog: Administrator privileges are required to modify watchdog configurations
Changing settings needs an administrator too.

The details are in the privacy notes of the repository.

Now the admission. When you uninstall the installer version of Network Watchdog, the uninstaller removes the program and its shortcuts but leaves the data folder behind, including the stored evidence cases (each roughly 50 to 80 MB), and the per-user log file stays too. It does not tell you, and I would criticise that in anybody else’s software. It is on my list: an option to remove the data on uninstall is planned, although keeping the data will remain the default. Until then, after uninstalling you can delete C:\ProgramData\NetworkWatchdogService (needs administrator rights) and %LocalAppData%\NetworkWatchdog yourself. A privacy tool that keeps your memory dumps after you uninstall it, without saying so, is a privacy tool with homework.

What Network Watchdog Does Today, and Who It Is For

After all these chapters, a plain list is overdue. This is what the current release of Network Watchdog does, and where it stops.

What it does

  • It counts sockets for every process. The service reads the Windows socket table every 15 seconds, including sockets that were reserved and never connected, and ETW keeps the count current in between.
  • It shows the state as a traffic light. Green below half of the restart limit, orange from half, red from 80 percent. The default limit is 1,000 sockets, and a slider in the dashboard changes it.
  • It shows what is going on. The dashboard has five tabs: live processes, settings and whitelist, a historical archive of every automatic restart, evidence cases, and session logs, which show only the restarts of the current session. Processes with 30 sockets or fewer are hidden by default.
  • It restarts the offender. At the limit, it stops the dependent services, ends the exact leaking process, waits about half a minute and starts the service again. A program that is not a Windows service is ended and not relaunched.
  • It tries not to be reckless. A whitelist (the popular browsers, steam and Discord are preconfigured, and the names of services hosted inside svchost work too), a cooldown of two minutes, and a quarantine that pauses restarts for a service after three attempts in an hour. Every attempt counts, successful or not.
  • It collects evidence on request. One click builds a single .zip with socket tables, event logs, restart history, a memory dump and a README for engineers. Capturing a case automatically before a restart is opt-in.
  • It keeps everything local. History and evidence stay on the PC. The only network code is the update check, and the optional syslog messages are off by default.

Who it is for

  • Owners of laptops with a leaking vendor background service. This is where it began, and the default configuration still watches LightingService.
  • People who see ERR_NO_BUFFER_SPACE or random network dropouts, but only when a process is exhausting sockets. If the cause is elsewhere, it cannot help.
  • Developers and IT hobbyists who need evidence for a vendor. The one-click case with its engineer README is the feature built for that. Handle it with care, as the privacy chapter above explains.
  • People who leave a PC running unattended. It runs as a service without a window, with a cooldown and a quarantine. Alerts reach you remotely only if you set up syslog.

If you only want to look at sockets, a viewer such as TCPView is simpler. What Network Watchdog adds is thresholds, automatic recovery and evidence.

Who should think twice

  • If you want a permanent fix: this is not it. It treats the symptom by restarting the process and does not repair the bug in that program.
  • If you cannot get administrator rights: installing, changing settings and collecting evidence all need them.
  • If you need it commercially: Network Watchdog is licensed under CC BY-NC 4.0. In plain words, you may use, share and adapt it for free as long as you give credit, but not for commercial purposes, such as in a paid product or service.
  • If your machine holds sensitive data: killing processes and taking memory dumps need a review first. A dump can contain anything the process held in memory, so keep cases private and check them before sharing.
  • I have since scanned the three evidence cases I collected.

Know this before installing

Network Watchdog is for 64-bit Windows, and I have tested it only on Windows 11, the only version that is still supported. Windows 10 uses the same architecture, so it should run there as well, but I have not tested it. The installer is not code-signed, so Windows SmartScreen shows an “Unknown publisher” warning on first run. The README explains how to unblock it, and the next chapter shows how to check the file before you do.

A low limit can restart healthy programs that legitimately hold many connections, which is exactly why the whitelist exists, as the story of my own browser showed. On an unattended PC, glance at the logs now and then, because a service in quarantine is not restarted until the window clears.

Where to Get It, and Where to Ask for Help

For a long time, the whole public face of Network Watchdog was a GitHub repository. A README is written for developers. It is a poor answer to the question most people actually ask: what does this thing do, and is it safe to run on my PC?

So the project now has its own project page. It explains the idea in plain language first and in technical detail second, shows the dashboard with captions, lists what the tool never does (it does not inspect traffic content, upload evidence or send syslog unless you set up a server) and answers the questions I get most often. There are no cookies, no trackers and no external scripts. It exists in English, Ukrainian and Italian.

It is also where the SHA-256 checksum of the installer lives, together with the PowerShell command to verify it. That matters because the installer is not code-signed: check the hash first, then deal with the SmartScreen warning. The page lives on my own domain, so it does not depend on GitHub or on any platform that may change its rules, and it lists a dedicated support mailbox on the same domain.

What I would do differently: create the project page and a support address first, not last. Preparing the next story in this series showed me that they are part of shipping a product, not decoration.

What Comes Next

The next milestone for Network Watchdog is version 1.10.0: the dashboard will show the name of the service hosted inside svchost and let you whitelist it with a click, there will be a list of protected defaults, and every dashboard tab will show the version of the service build, because after the renumbering story I would like you, and me, to always know which build we are looking at.

Then there is the experiment I am most curious about: finding out whether a Windows service can live in the Microsoft Store. That is a story of its own, and it comes next in the series.

A watchdog starts as a promise to one service. It grows up when it learns to keep that promise to everything else on the machine, including its owner…

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.