-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBUW_check.vbs
More file actions
48 lines (35 loc) · 1.24 KB
/
Copy pathBUW_check.vbs
File metadata and controls
48 lines (35 loc) · 1.24 KB
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
vbsInterpreter = "cscript.exe"
'Function to check status of USB
function readFromRegistry (strRegistryKey, strDefault )
Dim WSHShell, value
On Error Resume Next
Set WSHShell = CreateObject("WScript.Shell")
value = WSHShell.RegRead( strRegistryKey )
if value = "3" then
readFromRegistry= "Enabled"
elseif value = "4" then
readFromRegistry="Disabled"
else
readFromRegistry="Unknown"
end if
set WSHShell = nothing
end function
Dim oWMI, WQL, Instances, Instance
'Get base WMI object, "." means computer name (local)
Set oWMI = GetObject("WINMGMTS:\\.\ROOT\StandardCimv2")
'Create a WMI query text
WQL = "Select * from MSFT_NetAdapter"
'Get instances of MSFT_NetAdapter
Set Instances = oWMI.ExecQuery(WQL)
bluetooth_status="Disabled"
wifi_status="Disabled"
For Each Instance In Instances
If InStr(Instance.Name, "Bluetooth") And Instance.State<>3 Then
bluetooth_status="Enabled"
End If
If InStr(Instance.Name, "Wi-Fi") And Instance.State<>3 Then
wifi_status="Enabled"
End If
Next
usb_status= readfromRegistry("HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR\Start", "4")
wscript.echo "USB is: " & usb_status & vbCrLf & "Wifi is: " & wifi_status & vbCrLf & "Bluetooth is: " & bluetooth_status