Skip to content

Commit

Permalink
Merge pull request #2 from mattock/waitforstatus
Browse files Browse the repository at this point in the history
Make service shutdown more robust
  • Loading branch information
mattock authored Nov 15, 2016
2 parents efea46f + a1012f3 commit dbf74cc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test-openvpn.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@ Function Stop-Gui {
}

Function Stop-Openvpnservice {
Stop-Service OpenVPNService
Stop-Service OpenVPNServiceLegacy
foreach ($service in 'OpenVPNService', 'OpenVPNServiceLegacy') {
if (Get-Service -Erroraction Ignore $service) {
Stop-Service $service
(Get-Service $service).WaitForStatus('Stopped')
}
}
}

# Stop all openvpn-related processes
Expand Down

0 comments on commit dbf74cc

Please sign in to comment.