Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,949 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm generating a .bat script to check some configurations on our desktops for some devices to work better.
I need to disable the checkbox "Allow Computer to Turn Off This Device to Save Power" for a USB device on device manager using this bat.
Is there any way to do that by command prompt (cmd) or registry entry?
This .bat worked for me with a given DeviceID :
@echo off
REM deviceID="USB\VID_1A40&PID_0101\5&212AC8FC&0&8"
set deviceID="USB\VID_1A40^&PID_0101\5^&212AC8FC^&0^&8"
PowerShell -Command "Get-WmiObject -Namespace 'Root\WMI' -Class 'MSPower_DeviceEnable' | Where-Object { $_.InstanceName -like '*%deviceID%*' } | ForEach-Object { $_.Enable = $false; $_.Put() }"