From 075a62bb061e187330b7fa3c1c570cadca2271dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuli=20Sepp=C3=A4nen?= Date: Thu, 2 Feb 2017 15:02:02 +0000 Subject: [PATCH] Add -Help option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Samuli Seppänen --- Remove-Tapwindows.ps1 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Remove-Tapwindows.ps1 b/Remove-Tapwindows.ps1 index 1b01a7a..3c2828c 100644 --- a/Remove-Tapwindows.ps1 +++ b/Remove-Tapwindows.ps1 @@ -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]