(Lifetime Pageviews to my blog reached one million this month. Thank you for your support!)
In a recent Windows XP to Windows 7 deployment project, it was requested that bluetooth functionality be disabled on laptops during their migration to Windows 7. It was easy to automate in a task sequence disabling the bluetooth service and the bluetooth network adapter. However, even after doing this, the bluetooth icon was still showing in the system tray, indicating that some bluetooth functionality was still enabled. I was able to completely disable bluetooth by also disabling the bluetooth device in device manager. Then I needed to find a way to automate this without using device manager.
I found a command-line tool called devcon.exe, which is part of the Windows Driver Kit. I put the following commands in a batch file to completely disable bluetooth:
REM by Romano Jerez
REM disables Bluetooth Support Service and the Bluetooth Device Network Adapter
sc config bthserv start= disabled > c:\windows\temp\logs\disableBlueTooth.log 2>&1
wmic path win32_networkadapter where name="Bluetooth Device (Personal Area Network)" call disable >> c:\windows\temp\logs\disableBlueTooth.log 2>&1
REM disables Thinkpad Bluetooth 3.0 device
devcon.exe disable usb\vid_0A5C* >> c:\windows\temp\logs\disableBlueTooth.log 2>&1
Next, I configured the batch file to run in a "Run Command Line" step in the task sequence after the drivers are installed. The lines may be broken up incorrectly with the copy and paste operation. There are two lines (two commands) to disable the bluetooth support service and the bluetooth device network adapter; one starts with "sc config", and the other one with "wmic". There's one line (one command) to disable the bluetooth device in device manager, which starts with "devcon.exe".
Each command logs to a file called disableBlueTooth.log in the c:\windows\temp folder. The "2>&1" at the end of each line is needed so errors are also logged.
As you cann see, to disable the device I had to pass the hardware ID to devcon.exe. You can use the hdids parameter of devcon.exe to find the hardware ID for your device. For details on how to do this see DevCon Examples.
If you want to run the batch file only on laptops, use the IsLaptop variable. In this blog post I provide details on how to do use it.
In a recent Windows XP to Windows 7 deployment project, it was requested that bluetooth functionality be disabled on laptops during their migration to Windows 7. It was easy to automate in a task sequence disabling the bluetooth service and the bluetooth network adapter. However, even after doing this, the bluetooth icon was still showing in the system tray, indicating that some bluetooth functionality was still enabled. I was able to completely disable bluetooth by also disabling the bluetooth device in device manager. Then I needed to find a way to automate this without using device manager.
I found a command-line tool called devcon.exe, which is part of the Windows Driver Kit. I put the following commands in a batch file to completely disable bluetooth:
REM by Romano Jerez
REM disables Bluetooth Support Service and the Bluetooth Device Network Adapter
sc config bthserv start= disabled > c:\windows\temp\logs\disableBlueTooth.log 2>&1
wmic path win32_networkadapter where name="Bluetooth Device (Personal Area Network)" call disable >> c:\windows\temp\logs\disableBlueTooth.log 2>&1
REM disables Thinkpad Bluetooth 3.0 device
devcon.exe disable usb\vid_0A5C* >> c:\windows\temp\logs\disableBlueTooth.log 2>&1
Next, I configured the batch file to run in a "Run Command Line" step in the task sequence after the drivers are installed. The lines may be broken up incorrectly with the copy and paste operation. There are two lines (two commands) to disable the bluetooth support service and the bluetooth device network adapter; one starts with "sc config", and the other one with "wmic". There's one line (one command) to disable the bluetooth device in device manager, which starts with "devcon.exe".
Each command logs to a file called disableBlueTooth.log in the c:\windows\temp folder. The "2>&1" at the end of each line is needed so errors are also logged.
As you cann see, to disable the device I had to pass the hardware ID to devcon.exe. You can use the hdids parameter of devcon.exe to find the hardware ID for your device. For details on how to do this see DevCon Examples.
If you want to run the batch file only on laptops, use the IsLaptop variable. In this blog post I provide details on how to do use it.