エンドポイントセキュリティ製品がインストール時に追加した仮想ネットワークアダプタが、時にルーティング障害を引き起こすことから、インストール後にワンクリックでそんな仮想ネットワークアダプタをまとめて削除するバッチ処理を考察してみました。
Prologue
ことの発端は、Fortinet社のエンドポイントセキュリティ製品、FortiClientをインストールする時にセットアップされる仮想ネットワークアダプタ、基本的に切断状態なので使われることはありませんが、Windows起動時に有線なり無線のメインのネットワークアダプタでIPアドレスの取得に手間取ると、この仮想インターフェイスがリンクローカルアドレスのまま、デフォルトルートになってしまうことがよくあります。そうなると当然ネットには繋がらず、そのまま待っていても切り替わることはまず有りません。
現在社内では、FortiClientをインストール後、こうした仮想ネットワークアダプタを手作業で全て無効にしているのですが、このネットワークアダプタのウィンドウに辿り着くまでのUI遷移は地味に面倒で、バッチ処理が望まれていました。
これらの仮想ネットワークアダプタは削除してしまっても、FortiClientの機能には影響は無いようなので、無効化に留めずに削除してしまうバッチ処理を考えます(WFHで利用するSSL-VPNリモートアクセスにも使用されません)。
netshは限定的
この手のバッチ操作でまず思いつくnetshは、インターフェイスの有効・無効までしか操作出来ず、インターフェイス名の指定方法も曖昧な汎用名のみなので、バッチ操作には不向きです。
1 2 3 4 5 6 7 8 9 10 11 |
C:\>netsh interface show interface Admin State State Type Interface Name ------------------------------------------------------------------------- Enabled Connected Dedicated Wi-Fi 2 Enabled Disconnected Dedicated Ethernet Enabled Disconnected Dedicated Ethernet 2 Enabled Disconnected Dedicated Ethernet 3 C:\>netsh interface set interface "Ethernet 2" disable C:\>netsh interface set interface "Ethernet 2" enable |
DevCon.exeなら簡単も
ネットワークアダプタを無効化・有効化する程度であればnetshで容易に可能ですが、削除となると面倒です。Windows Driver Kitなどの開発ツールに含まれる、DevCon.exeを使う方法がDOSレベルで単純なのですが、WDKもしくはDevCon.exe単体をインストールする必要が生じるので、任意のPCに施工するには不向きです。
とは言え、DevCon.exeとはどのようなツールなのか、試してみたいので入手してみます。現行ではまずVisual Studio 2019を導入してから云々、と果てしない道のり。
単体のCABアーカイブを直リンからダウンロードする方法を解説しているサイトもありますが、更新が止まっています。そんな中、プレビュー版WDKをダウンロード出来るページを見つけました。幸い、Windows Insider Programに加入しているので、ログインの後、プレビュー版WDKをダウンロードします(執筆時点でビルド20279)。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Windows_InsiderPreview_WDK_x86x64_en-us_20279.iso 639588352 Byte │ ├── Installers │ ├── 00764edd0b3a48a0db94263bbf478c1b.cab │ ├── 00ce0ca4498d20b325845d4c6b6c92df.cab (略) │ ├── 82c1721cd310c73968861674ffc209c9.cab (略) │ ├── 787bee96dbd26371076b37b13c405890.cab (略) │ └── wdksetup.exe 1 directory, 269 files |
このISOファイル内の「Installer」フォルダにある大量のCABアーカイブの中からDevCon.exeを見つけます。その要領についてはこちらのフォーラムに解説があり、それは以下の通りです。
32bit
- アーカイブ名 82c1721cd310c73968861674ffc209c9.cab の中にある、
- ファイル名 fil5a9177f816435063f779ebbbd2c1a1d2 を取り出して「DevCon.exe」にリネーム。
64bit
- アーカイブ名 787bee96dbd26371076b37b13c405890.cab の中にある、
- ファイル名 filbad6e2cce5ebc45a401e19c613d0a28f を取り出して「DevCon.exe」にリネーム。
早速DevCon.exeを使って、FortiClientが生成した仮想インターフェイスに関する情報を取得してみましょう。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
C:\>devcon findall =net | findstr /I "fortinet pppop" ROOT\NET\0000 : Fortinet Virtual Ethernet Adapter (NDIS 6.30) ROOT\NET\0001 : Fortinet SSL VPN Virtual Ethernet Adapter ROOT\NET\0002 : PPPoP WAN Adapter C:\>devcon hwids =net ~抜粋~ ROOT\NET\0000 Name: Fortinet Virtual Ethernet Adapter (NDIS 6.30) Hardware IDs: root\ftvnic_a ROOT\NET\0001 Name: Fortinet SSL VPN Virtual Ethernet Adapter Hardware IDs: root\ftsvnic ROOT\NET\0002 Name: PPPoP WAN Adapter Hardware IDs: PPPoPWan 17 matching device(s) found. |
デバイスインスタンスパス(ROOT\NET\0000など)はデバイスの構成によって連番が変わってしまうので、特定には使えません。ハードウェアID(root\ftvnic_aなど)を使って操作するのがより安全と言えます(どちらを使っても操作は可能)。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
C:\>devcon disable root\ftsvnic ROOT\NET\0001 : Disabled 1 device(s) disabled. C:\>devcon disable @ROOT\NET\0001 ROOT\NET\0001 : Disabled 1 device(s) disabled. C:\>devcon enable root\ftsvnic ROOT\NET\0001 : Enabled 1 device(s) are enabled. C:\>devcon remove root\ftsvnic ROOT\NET\0001 : Removed 1 device(s) were removed. C:\>devcon remove PPPoPWan ROOT\NET\0002 : Removed 1 device(s) were removed. |
以上のことから、DevCon.exeを使ったバッチは次のようになるでしょう。
1 2 3 4 5 |
:: FortiClient V.IF remove batch as follows; C:\>devcon remove root\ftvnic_a C:\>devcon remove root\ftsvnic C:\>devcon remove PPPoPWan C:\>rasphone -r fortissl |
最後にfortisslと言うダイアルアップコネクションを消しているのは、古くからDOSにあるrasphoneコマンドです。
PnPUtil.exeを勧められるも
DevCon.exeの頁を開いた時に目についた「DevConの代わりに PnPUtilツールを使用してください」と言う文言。
これは主にドライバのインストール・アンインストールに使うようなツールに見え、デバイスの削除も可能とありますが、動作環境がWindows 10の中でもかなり最近のバージョンの必要があるようです。その代わりWindows標準で入っているので、新たなインストール作業は不要。今回使っているPCのバージョンは次の通りです。
1 2 |
C:\>ver Microsoft Windows [Version 10.0.19042.685] |
それではPnPUtilを使って同様の情報を取得してみましょう。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
C:\>pnputil /enum-devices /ids /class net Microsoft PnP Utility ~抜粋~ Instance ID: ROOT\NET\0000 Device Description: Fortinet Virtual Ethernet Adapter (NDIS 6.30) Class Name: Net Class GUID: {4d36e972-e325-11ce-bfc1-08002be10318} Manufacturer Name: Fortinet Status: Started Driver Name: oem0.inf Hardware IDs: root\ftvnic_a Instance ID: ROOT\NET\0001 Device Description: Fortinet SSL VPN Virtual Ethernet Adapter Class Name: Net Class GUID: {4d36e972-e325-11ce-bfc1-08002be10318} Manufacturer Name: Fortinet Inc. Status: Started Driver Name: oem15.inf Hardware IDs: root\ftsvnic Instance ID: ROOT\NET\0002 Device Description: PPPoP WAN Adapter Class Name: Net Class GUID: {4d36e972-e325-11ce-bfc1-08002be10318} Manufacturer Name: Fortinet Inc. Status: Started Driver Name: oem18.inf Hardware IDs: PPPoPWan C:\>pnputil /enum-drivers Microsoft PnP Utility ~抜粋~ Published name : oem16.inf Driver package provider : Fortinet Class : Network Service Driver date and version : 06/07/2018 2018.6.7.0 Signer name : Microsoft Windows Hardware Compatibility Publisher Published name : oem15.inf Driver package provider : Fortinet Class : Network adapters Driver date and version : 04/13/2020 2020.4.13.0 Signer name : Microsoft Windows Hardware Compatibility Publisher Published name : oem0.inf Driver package provider : Fortinet Class : Network adapters Driver date and version : 04/09/2020 2020.4.9.0 Signer name : Microsoft Windows Hardware Compatibility Publisher Published name : oem18.inf Driver package provider : Fortinet Class : Network adapters Driver date and version : 03/22/2016 2016.3.22.0 Signer name : Microsoft Windows Hardware Compatibility Publisher |
構成に依らず一意なハードウェアIDは閲覧出来るものの、デバイスの操作にはインスタンスIDを使うしかなく、その末尾の連番はPCの構成によって異なることから、汎用的にバッチ操作させるにはハードウェアIDからインスタンスIDを得る仕組みが別途必要になります。ちなみにデバイスは次のようにあっさり削除できます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
C:\>pnputil /remove-device ROOT\NET\0000 Microsoft PnP Utility Removing device: ROOT\NET\0000 Device removed successfully. C:\>pnputil /remove-device ROOT\NET\0001 Microsoft PnP Utility Removing device: ROOT\NET\0001 Device removed successfully. C:\>pnputil /remove-device ROOT\NET\0002 Microsoft PnP Utility Removing device: ROOT\NET\0002 Device removed successfully. |
wmicはどうか
WMIのコマンドラインツールwmicを使ってもネットワークアダプタを操作することは可能です。NIC関連の情報全フィールドは以下の通り膨大です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
AdapterType AdapterTypeId AutoSense Availability Caption ConfigManagerErrorCode ConfigManagerUserConfig CreationClassName Description DeviceID ErrorCleared ErrorDescription GUID Index InstallDate Installed InterfaceIndex LastErrorCode MACAddress Manufacturer MaxNumberControlled MaxSpeed Name NetConnectionID NetConnectionStatus NetEnabled NetworkAddresses PermanentAddress PhysicalAdapter PNPDeviceID PowerManagementCapabilities PowerManagementSupported ProductName ServiceName Speed Status StatusInfo SystemCreationClassName SystemName |
その中からデバイス特定に使えそうなフィールドを選んでみました。
1 2 3 4 5 6 |
C:\>wmic nic get Index, PNPDeviceID, Name, ServiceName ~抜粋~ Index Name PNPDeviceID ServiceName 14 Fortinet Virtual Ethernet Adapter (NDIS 6.30) ROOT\NET\0000 ft_vnic 15 Fortinet SSL VPN Virtual Ethernet Adapter ROOT\NET\0001 ftsvnic 16 PPPoP WAN Adapter ROOT\NET\0002 pppop |
ServiceNameがハードウェアIDにほぼ則しているようです。デバイス操作は次の通りで実現出来るのは無効・有効化までで、削除する方法は見当たりませんでした(ドライバ削除までは「wmic sysdriver」で可能)。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
C:\>wmic path Win32_NetworkAdapter where ServiceName="ft_vnic" call disable Executing (\\VPCF135FG\root\cimv2:Win32_NetworkAdapter.DeviceID="14")->disable() Method execution successful. Out Parameters: instance of __PARAMETERS { ReturnValue = 0; }; C:\>wmic path Win32_NetworkAdapter where ServiceName="ft_vnic" call enable Executing (\\VPCF135FG\root\cimv2:Win32_NetworkAdapter.DeviceID="14")->enable() Method execution successful. Out Parameters: instance of __PARAMETERS { ReturnValue = 0; }; |
その他全体的に枯れたテクノロジーなので、公式ですらリファレンス類は冷たい印象で、そんな中以下の記事がとても参考になりました(Great Tnx!!)。
Powershellによるアプローチ
Powershellの豊富な機能であればネットワークアダプタの操作も可能でしょう。但し実行の際、セキュリティ設定の面倒なおまじない(Set-ExecutionPolicy RemoteSigned)が憑いてまわるので、任意のPCでps1スクリプトファイルをダブルクリックすればそれだけで完結するものではありません。今回この問題はPowershellのps1ファイルをexe形式のバイナリ実行ファイルに変換するツール、PS2EXEを使い、ポリシー問題を回避しようと目論んでいます(GUI版も存在します)。
まずはPowershellにおける、ComponentIDで指定した特定のNICの無効・有効化は次のように行えます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
## 無効化 PS> Get-NetAdapter | Where-Object {$_.ComponentID -eq "root\ftsvnic"} | Disable-NetAdapter -Confirm:$False PS> Get-NetAdapter | Where-Object {$_.ComponentID -eq "root\ftvnic_a"} | Disable-NetAdapter -Confirm:$False PS> Get-NetAdapter | Where-Object {$_.ComponentID -eq "PPPoPWan"} | Disable-NetAdapter -Confirm:$False ## 無効化一括 PS> Get-NetAdapter | Where-Object {($_.ComponentID -eq "root\ftsvnic") -or ($_.ComponentID -eq "root\ftvnic_a") -or ($_.ComponentID -eq "PPPoPWan")} | Disable-NetAdapter -Confirm:$False ## 有効化 PS> Get-NetAdapter | Where-Object {$_.ComponentID -eq "root\ftvnic_a"} | Enable-NetAdapter -Confirm:$False PS> Get-NetAdapter | Where-Object {$_.ComponentID -eq "root\ftsvnic"} | Enable-NetAdapter -Confirm:$False PS> Get-NetAdapter | Where-Object {$_.ComponentID -eq "PPPoPWan"} | Enable-NetAdapter -Confirm:$False ## 有効化一括 PS> Get-NetAdapter | Where-Object {($_.ComponentID -eq "root\ftsvnic") -or ($_.ComponentID -eq "root\ftvnic_a") -or ($_.ComponentID -eq "PPPoPWan")} | Enable-NetAdapter -Confirm:$False |
しかしながらNetAdapterで操作できるのもやはりここまで。更に調べを進めると、インスタンスIDを使ってレジストリキーを削除する方法があるようです。簡単なテストバッチを組んでみました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$Devs = Get-PnPDevice -Class net | ? {($_.HardwareId -eq "root\ftvnic_a") -or ($_.HardwareId -eq "root\ftsvnic") -or ($_.HardwareId -eq "PPPoPWan")} | Select FriendlyName, InstanceId if ($Devs -ne $null) { Write-Host "Current NICs;" Get-NetAdapter Write-Host "`r`nNIC to be removed:"$Devs.FriendlyName ForEach ($Dev in $Devs) { $RemoveKey = "HKLM:\SYSTEM\CurrentControlSet\Enum\$($Dev.InstanceId)" Get-Item $RemoveKey | Select-Object -ExpandProperty Property | %{ Remove-ItemProperty -Path $RemoveKey -Name $_ -Verbose } } Write-Host "Removed.`r`n`r`nRemaining NICs;" Get-NetAdapter } else { Get-NetAdapter Write-Host "`r`nNothing to do" } |
実行させてみます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
PS C:\> .\rm_ftvnics.ps1 Current NICs; Name InterfaceDescription ifIndex Status LinkSpeed ---- -------------------- ------- ------ ---------- Local Area Connection PPPoP WAN Adapter 59 Disconnected 0 bps Bluetooth Network Con...2 Bluetooth Device (Personal Area Ne...#2 19 Disconnected 3 Mbps Ethernet 3 Fortinet SSL VPN Virtual Ethernet Ad... 46 Disconnected 100 Gbps Wi-Fi 2 Intel(R) Dual Band Wireless-AC 7260 13 Up 144.4 Mbps Ethernet Marvell Yukon 88E8057 PCI-E Gigabit ... 11 Disconnected 1 Gbps Ethernet 2 Fortinet Virtual Ethernet Adapter (N... 42 Disconnected 100 Mbps NIC to be removed: Fortinet Virtual Ethernet Adapter (NDIS 6.30) Fortinet SSL VPN Virtual Ethernet Adapter PPPoP WAN Adapter VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0000 Property: ClassGUID". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0000 Property: HardwareID". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0000 Property: Capabilities". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0000 Property: Service". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0000 Property: DeviceDesc". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0000 Property: Driver". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0000 Property: Mfg". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0000 Property: ConfigFlags". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0000 Property: ContainerID". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0000 Property: FriendlyName". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0001 Property: ClassGUID". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0001 Property: HardwareID". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0001 Property: Capabilities". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0001 Property: Service". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0001 Property: DeviceDesc". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0001 Property: Driver". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0001 Property: Mfg". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0001 Property: ConfigFlags". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0001 Property: ContainerID". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0001 Property: FriendlyName". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0002 Property: ClassGUID". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0002 Property: HardwareID". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0002 Property: Capabilities". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0002 Property: Service". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0002 Property: DeviceDesc". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0002 Property: Driver". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0002 Property: Mfg". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0002 Property: ConfigFlags". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0002 Property: ContainerID". VERBOSE: Performing the operation "Remove Property" on target "Item: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ROOT\NET\0002 Property: FriendlyName". Removed. Remaining NICs; Name InterfaceDescription ifIndex Status MacAddress LinkSpeed ---- -------------------- ------- ------ ---------- --------- Bluetooth Network Con...2 Bluetooth Device (Personal Area Ne...#2 19 Disconnected F8-16-54-D1-BF-36 3 Mbps Wi-Fi 2 Intel(R) Dual Band Wireless-AC 7260 13 Up F8-16-54-D1-BF-32 130 Mbps Ethernet Marvell Yukon 88E8057 PCI-E Gigabit ... 11 Disconnected 78-84-3C-05-B7-D7 1 Gbps |
アダプタ一覧からもFortiClient仮想アダプタが消えたので、一見成功に見えたのですがレジストリエディタで覗いてみると消せない残骸が。手動で消そうとしても権限の関係で消せません。DOSのregコマンドでも同様にエラーで残骸は消せず。この方法は使えません。
その辺りをおそらくうまく回避し、FortiClientに限らず様々な仮想アダプタへ汎用化させたお掃除スクリプトがこちらです。もはや芸術的(Fabulous Works!!)。
Epilogue
以上、様々な手法を試してみましたが、最も安全確実に仮想アダプタを削除出来るのはDevCon.exeと感じました。実際に運用してもらうバッチを次のように仕上げてみました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
@echo off pushd %~dp0 echo ### FortiClient Virtual Interface Remover ### echo. :: DevCon.exe Validity Check where /q devcon.exe if errorlevel 1 ( echo DevCon.exe Missing, Batch Aborted. Press any key to close this window... pause > NUL exit /b ) :: Open "Network Adapters" Window :: ncpa.cpl :: List Current NICs echo ## Current NICs as follows; devcon listclass net | findstr /v "Miniport Microsoft" echo. echo Press Any Key to REMOVE... pause > NUL :: Remove Virtual Adapters devcon.exe remove root\ftvnic_a devcon.exe remove root\ftsvnic devcon.exe remove PPPoPWan :: Delete "fortissl" Dialup Connection rasphone -r fortissl :: List Remaining NICs echo ## Remaining NICs as follows; devcon listclass net | findstr /v "Miniport Microsoft" ncpa.cpl echo. echo Press any key to close this window pause > NUL |
実行結果はこのように。ネットワーク接続ウィンドウを最後に呼び出して、GUIベースの視認も付けています。
これをDevCon.exeと共にFortiClientのインストーラのある場所に配置し、インストール担当者には「インストール後にこのバッチを管理者として実行してね」と申し送りしてもらいます。
参考)