Thursday, June 19, 2014

How to disable Local area connection -power management options Using Vb scripts

Below Script will check for PnPCapabilities and replace the value

Option Explicit

Const HKEY_LOCAL_MACHINE = &H80000002

Dim objReg
Dim strComputer, strKeyPath, arrSubKeys, arrValueTypes, arrValueNames
Dim subkey, i

on error resume next
 strComputer = "."

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

 strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}"

objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
      objReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, arrValueNames, arrValueTypes
        for i=0 to ubound(arrValuenames)
                if arrValueNames(i) = "PnPCapabilities" then
                        objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, "PnPCapabilities", 56
                End If
        next
     
Next

Set objReg = nothing

No comments:

Post a Comment