mbt masai
 
Welcome !
         

                                
After experiencing a lot of down time, We decided to move this site to CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.

 Disable USB Root Hub Power Management

Author Message
will.steele

  • Total Posts : 4
  • Scores: 0
  • Reward points : 0
  • Joined: 5/4/2009
  • Status: offline
Disable USB Root Hub Power Management Monday, May 04, 2009 7:15 AM (permalink)
0
' AUTHOR:  Will Steele
' CREATED:  1/22/2009
' PURPOSE:  The script turns off power management for USB Root Hubs.
' NOTE:  Change (line 8) HcDisableSelectiveSuspend to &H00000000 to enable power management for all USB Root Hubs.
'   Change (line 8) HcDisableSelectiveSuspend to &H00000001 to disable power management for all USB Root Hubs.
'   Be aware this script will not display automatically in the device management tab for each USB root hub.  Changes will appear
'   in the GUI only after a reboot. Note also that changes are effective immediately.
 
' Designate hex values for registry constants to be used in script
Const HKEY_LOCAL_MACHINE = &H80000002
Const HcDisableSelectiveSuspend = &H00000001
 
' Specify the value for querying in the registry keys
strValueName = "HcDisableSelectiveSuspend"
strComputer = "."

' Add a key for searching in the regular expression
DriverDesc = "DriverDesc"

' Get registry root for querying
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

' Specify path to query
strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-444553540000}"

' Get subkeys into array
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

' Initialize regular expression
set re = new regexp
 
' Specify pattern for regular expression
re.pattern = "Host Controller"
 
' Initialize a variable to use as a counter
pathCount = 0
 
' Loop based on the length of the arrSubKeys array returned regular expression
For pathCount = 0 To UBound(arrSubKeys)
 
' Create path specific strings based on array length of 10 or less
If pathCount < 10 Then
 
' Append path count to path string
strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-444553540000}\000" & pathCount

' Get value of string
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,DriverDesc,strValue

' evaluate regular epxression
set test = re.Execute(strValue)
 
' If HcDisableSelectiveSuspect key does not exist, add it and set the value
If test.Count Then
  oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath,DriverDesc,strValueName
  oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,HcDisableSelectiveSuspend
  'WScript.Echo (CStr(strKeyPath & "\" & CStr(strValueName) & " set to - " & CInt(HcDisableSelectiveSuspend)))
End If 
 
' Create path specific string based on array length of 10 or more
Else
 
' Append path to path string
strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-444553540000}\00" & pathCount

' Get value of string
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,DriverDesc,strValue

'evaluate regular expression
set test = re.Execute(strValue)

' If hcDisableSelectiveSuspend key does not exist, add it and set the value
If test.Count Then
  oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath,DriverDesc,strValueName
  oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,HcDisableSelectiveSuspend
  'WScript.Echo (CStr(strKeyPath & "\" & CStr(strValueName) & " set to - " & CInt(HcDisableSelectiveSuspend)))
End If
End If
Next
 
' Report status of update
If CStr(HcDisableSelectiveSuspend) = 0 Then
WScript.Echo ("All USB Root Hubs have been configured to have power management enabled.")
Else
WScript.Echo ("All USB Root Hubs have been configured to have power management disabled.")
End If
<message edited by will.steele on Monday, May 04, 2009 7:24 AM>
#1
    EnigmaV8

    • Total Posts : 1
    • Scores: 0
    • Reward points : 0
    • Joined: 11/23/2009
    • Status: offline
    Re: Disable USB Root Hub Power Management Monday, November 23, 2009 12:05 PM (permalink)
    0

    That's pretty sweet scripting!  Hate to tell you though...

    You can simply edit this one key which turns off power management of all USB ports and even eliminates the option tab for power management on the Root HUB properties page.

    http://support.microsoft.com/kb/895962


    Basically:   
    Create Key:   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USB
    Create Value:   REG_DWORD:  DisableSelectiveSuspend  =  1

    No more power management on any USB and no more tab for it either.
    #2
      mcds99

      • Total Posts : 515
      • Scores: 4
      • Reward points : 0
      • Joined: 2/28/2006
      • Status: offline
      Re:Disable USB Root Hub Power Management Tuesday, December 01, 2009 8:47 AM (permalink)
      0
      However is there a reason why this is turned off.
       
      Wouldn't want to damage my G1 phone when tethered to my laptop by pushing to much voltage.
       
       
      Sam

      Keep it Simple Make it Fun KiSMiF
      #3
        SS12

        • Total Posts : 1
        • Scores: 0
        • Reward points : 0
        • Joined: 8/10/2010
        • Status: offline
        Re:Disable USB Root Hub Power Management Tuesday, August 10, 2010 4:41 AM (permalink)
        0
        Hi Will and EnigmaV8,
        Both the method works and it is possible to Disable USB Suspend but both of these need restart to take effect. I tried on Windows XP service pack 3. I am into big trouble that I do not have luxury to restart the PC running this script. So I must do something that these changes affect immediately. However "devmgmt.msc -> Universal Serial Bus Controller -> USB Root Hub -> Properties -> Powermanagement -> Allow the computer to turn off this device to save power." changes effect immediately as I can see the USB currect drops or increase from power save immediately.
        Is there anything that can help to affect he changes like devmgmt.msc does? I treid using API mon to see what it is doing but could not succed. Do you guys have any idea?
        #4

          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 1 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.8
          mbt shoes www.wileywilson.com