i made script that check status cisco virtual adapter and if status ‘up’ service network list service is stopped and disabled, if status ‘disabled’ start network list service.
$up = "Up"
$disabled = "Disabled"
$lan = "Cisco Systems VPN Adapter for 64-bit Windows"
this script works ok when i start them manualy, but i want that the script is working automatically, when status virtual adapter changes from disabled to up automatic stops th network list service and disabling?
Two basic methods to trigger based on event, WMI and Windows Event. Get-NetAdapter uses WMI to get the underlying information, it’s basically a wrapper function. First you would have to translate the Get-NetAdapter to a WMI query:
Another choice would be a Windows Event Viewer event, which not sure what you are querying would cause and event, but here is some information if you want to take a look: