February 25, 2016 at 8:28 am #35684
I want to create a powershell script that alerts a user on a device that they have lost network connectivity.
– Can i set an alert through WMI ?
– Would it have to be a service running all the time and alert if network connections goes ?
– Should i use a workflow so the script continues or just loop ?
Got a few thoughts but not sure how to go forward with it.
February 25, 2016 at 8:58 am #35689
WMI isn't an "alerting" system. You could potentially have WMI trigger an event that notified your own code, sure. And I'd strongly recommend that it be a service, yes – services are designed to run in the background. But that means not writing it in PowerShell, as PowerShell is **not** designed to run as a continuous service. And no, Workflow isn't designed for this, either.
I'm a little confused, though, because since at least Windows 7, there's been a task bar alert when this happens, right? I'm guessing your users just aren't noticing that.
In any event, I don't personally feel PowerShell is a good solution for this. It's going to be a kludge at best, and an ugly kludge at that. At worst, it'll end up being a memory hog (remember, PowerShell fires up a good portion of .NET, which is a little lazy about memory).
February 25, 2016 at 9:36 am #35699
Thanks Don. The users are field engineers and it was to advise them. Your right, the notification is a bit small for them as they are on tablets running Windows 8.1.
I was just thinking of a script that would pop up a gui window when the connection was lost.
February 25, 2016 at 10:33 am #35702
Don is right but if you have to do it here is an option.
You could use a powershell script to display a message but let task scheduler look for the lost network connect event http://www.groovypost.com/howto/automatically-run-script-on-internet-connect-network-connection-drop/
February 25, 2016 at 10:58 am #35704
That looks useful Jonathan, thanks. Just a solution to help some engineers. Could I script the creation of the schedule to setup on mass ?
February 25, 2016 at 11:26 am #35705
You must be logged in to reply to this topic.