Skip to content

Commit

Permalink
Add -Help option
Browse files Browse the repository at this point in the history
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
  • Loading branch information
mattock committed Feb 2, 2017
1 parent 3d9947f commit 075a62b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Remove-Tapwindows.ps1
Expand Up @@ -3,22 +3,30 @@
# Remove all tap-windows adapters from the driver store using PnPutil.exe

Param(
[switch]$Yes
[switch]$Yes,
[switch]$Help
)

Function Show-Usage {
Write-Host "Usage: Remove-Tapwindows.ps1 [-Yes]"
Write-Host
Write-Host "Usage: Remove-Tapwindows.ps1 [-Yes] [-Help]"
Write-Host
Write-Host "Parameters:"
Write-Host " -Yes Remove drivers instead of just showing what would get removed"
Write-Host " -Help Display this help message"
Write-Host
Write-host "Disclaimer: USE AT YOUR OWN RISK."
exit 1
}

$driverlist = Invoke-Command -ScriptBlock { & C:\Windows\System32\PnPutil.exe -e }

$tap_found = $false

if ($Help) {
Show-Usage
}

foreach ($line in $driverlist) {
if ($line.StartsWith("Published name")) {
$published_name = $line.Replace(" ","").Split(":")[1]
Expand Down

0 comments on commit 075a62b

Please sign in to comment.