Thursday, June 19, 2014

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

Below Script will check for PnPCapabilities and replace the value and it will also check for IPV4 network connection and add PnPCapabilities Value.

Option Explicit

Const HKEY_LOCAL_MACHINE = &H80000002

Dim objReg
Dim strComputer, strKeyPath, arrSubKeys, arrValueTypes, arrValueNames,arrValueNames1,arrValueTypes1
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


     
        objReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, arrValueNames, arrValueTypes
     
        for i=0 to ubound(arrValuenames)
                'wscript.echo "Value Name: " & arrValueNames(i)
                if arrValueNames(i) = "PnPCapabilities" then
                        objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, "PnPCapabilities", 56
                End If
        next

       objReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, arrValueNames1, arrValueTypes1
        for i=0 to ubound(arrValuenames1)
                if arrValueNames1(i) = "*LsoV1IPv4" then
                        objReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath & "\" & subkey, "PnPCapabilities", 56
                End If
        next

Next

Set objReg = nothing

No comments:

Post a Comment