We'd like to know where a user has docked their computer. This tells us about what parts of the office get used, and allows people to find each other.
We have a working system that uses Windows Task Scheduler to observe a change in the network adaptor status, and that triggers a PowerShell script that sends a POST request.
So that's basically when the computer connects to the network in a new way, is the user connected to a cable or on the Wi-Fi etc.
When the PowerShell script runs, it flashes a window and also takes focus from what the user is doing. This is fine for a little prototype, but is too distracting in the long term.
What we're looking for
======================
We want to switch from an event-triggered PowerShell to a background process that can run silently on a user's computer. The most obvious way to do that seems to be to build it as a C# program.
We'd like to drop the event-driven, task scheduler part, and move to a scheduled event on a timer, probably running Coravel or something similar. This seems like it'll give us better data, but if it's easy to do both then we might as well.
I'm a fairly competent python dev, but I don't work with C# in a software engineering way. (I've used it as scripting language in the past, so I can read it a bit.)
What success looks like
========================
We'll have a working program that can be deployed as a background process. It'll send well formed post requests containing some information about the user's context. The code will be maintainable and not be a resource hog. We'll both be happy with the outcome and excited to work together again.
Details
=======
This is the PowerShell script: https://gist.github.com/notionparallax/b503c4a256363acc35e49527956cfc11
The event we were listening for is the `Microsoft-Windows-NetworkProfile/Operational` 4004 event, in the event that it's easy to listen to the event as well as poll for updates.
I prefer to work in a shared GitHub repo.
Prompts
=======
There is a stack overflow answer here that seems to address some of the task scheduler part: https://stackoverflow.com/a/43916015/1835727
https://serilog.net/ looks like it makes nice log entries