top of page
Search

(173) Microsoft Intune - Turning off "Allow the computer to turn off this device to save power" against your USBs

  • Writer: Mr B SOE way
    Mr B SOE way
  • 1 day ago
  • 1 min read

Had a customer who difficult getting these ports to never sleep, originally I used this policy which worked for applications but not for ports.














To get it working, I created a PowerShell script with the following:


# Dynamic power devices
$powerMgmt = Get-CimInstance -ClassName MSPower_DeviceEnable -Namespace root/WMI

# All USB devices
$UsbDevices = Get-CimInstance -ClassName Win32_PnPEntity -Filter 'PNPClass = "USB"'

$UsbDevices | ForEach-Object {
    # Get the power management instance for this device, if there is one
    $powerMgmt | Where-Object InstanceName -Like "*$($_.PNPDeviceID)*"
} | Set-CimInstance -Property @{Enable = $false}

On Intune, make sure to set the following:

Run this script using the logged on credentials: No

Enforce script signature check: No

Run script in 64 bit PowerShell Host: No


Once deployed successfully, go to Device Manager > Universal Serial Bus Connectors > Right click on any USB related port > Power Management and you will see this "Allow the computer to turn off this device to save power" is unticked



 
 
 

Comments


bottom of page