Do you handle any scripting with batch still? No?!
Do you need to make a scheduled task using schtasks.exe that runs a PS script in a hidden window every time a network connection is made? No?!
Perfect!
Here is a one line cmd batch script for adding exactly that!
schtasks /create /tn "Net-Connected" /tr "powershell -executionpolicy bypass -file '%SYSTEMDRIVE%\example.ps1'" /SC ONEVENT /EC Microsoft-Windows-NetworkProfile/Operational /MO "*[System[Provider[@Name='Microsoft-Windows-NetworkProfile'] and EventID=10000]]" /RU "System" /F