0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

VBScriptでネットワークアダプターを復活させる

Posted at

背景

WindowsでノートPCをスリープ状態から復元するとWirelessが死んでしまうけど、
電源オプション周りで調整ができなかった。

デバイスマネージャでWirelessのハードの無効・有効操作で復活できることが分かっている。
この操作を毎回やるのも邪魔なので、VBSでやってみようとして作ったスクリプト。

スクリプト

例のWirelessのデバイス名は[00000011] Intel(R) Wireless-N 7260となっている。
個人のデバイスマネージャーを確認して差し替える必要あり。
コメントアウトになっている部分:Retを開放して実行することで確認できる。

restart_wireless.vbs
'-----------------------------------
'Device list
'Availability
'1 Other. 2 Unknown. 3 Running/full power. 4 Warning. 5 Testing. 
'6 Not applicable. 7 Power off. 8 Offline. 9 Off duty. 
'10 Degraded. 11 Not installed. 12 Install error. 13-17 Power save. 
'18 Paused. 19 Not ready. 20 Not configured. 21 Quiesced. 
'-----------------------------------
Option Explicit

Dim QfeSet
Dim Qfe
Dim Locator
Dim Service
Dim Ret

Set Locator = WScript.CreateObject("WbemScripting.SWbemLocator")
Set Service = Locator.ConnectServer
Set QfeSet = Service.ExecQuery("Select * From CIM_LogicalDevice Where Availability=3")

For Each Qfe In QfeSet
  'Ret = Ret & Qfe.Caption & vbCrLf
  If Qfe.Caption = "[00000011] Intel(R) Wireless-N 7260" Then
    Wscript.Echo Qfe.Caption
    Qfe.Disable
    Wscript.Sleep 2000
    Qfe.Enable
  End If
Next

'Wscript.Echo Ret

参考

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?