Hi,
Please see if this works
$UpNetwork = {
$up = "Up"
$lan = "Cisco Systems VPN Adapter for 64-bit Windows"
$lanUp = Get-NetAdapter | select interfacedescription,Status | where { $.Status -match $up -and $.interfacedescription -match $lan }
$servicerunning = Get-Service netprofm | select status,starttype | where { $.Status -match $running -and $.starttype -match $manual }
if ($lanUp)
{
If($servicerunning)
{
Get-Service netprofm | Stop-Service -PassThru | Set-Service -StartupType disabled
}
}
}
Register-WMIEvent -Namespace root\wmi -Class MSNdis_StatusMediaConnect -Action $UpNetwork
Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.