I'd like to change the value, HKEY_CURRENT_USER\Control
Panel\PowerCfg\PowerPolicies\0\Policies, not PowerPolicies.
This value is the type "REG_Binary" and very long.
Please refer to below contents.
Dim NWWshShell
=====================================================
Set NWWshShell = WScript.CreateObject("WScript.Shell")
NWWshShell.RegWrite "HKCU\Control
Panel\PowerCfg\PowerPolicies\0\Policies_Test", 01 00 00 00 00 00 00 00 01 00
00 00 00 00 00 00 02 00 00 00 00 00 00 00 58 02 00 00 32 32 00 03 04 00 00 00
04 00 00 00 00 00 3D 77 2E F2 07 00 B0 04 00 00 2C 01 00 00 00 00 00 00 84 03
00 00 00 00 64 64 64 64 91 7C, "REG_BINARY"
wscript.echo "The Power Saver Time Successfully Configured"
=====================================================
But, the function "RegWrite" can't conduct upper script.
So, I try it with function "SetBinaryValue.
=====================================================
Const HKEY_CURRENT_USER = &H80000001
Set objRegistry = _
GetObject("Winmgmts:root\default:StdRegProv")
strPath = "Control Panel\PowerCfg\PowerPolicies\0\Policies"
uBinary1 =
Array(01,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,00,00,00,00,58,02,00,00,32,32,00,03,04,00,00,00,04,00,00,00,00,00,3D,77,2E,F2,07,00,B0,04,00,00,2C,01,00,00,00,00,00,00,84,03,00,00,00,00,64,64,64,64,91,7C)
Return = objRegistry.SetBinaryValue(HKEY_CURRENT_USER, _strPath,
_"MyBinaryNamedValue", _uBinary1)
If (Return = 0) And (Err.Number = 0) Then
Wscript.Echo "Binary value added successfully"
Else
' An error occurred
End If
=====================================================
But I'm in face of below error message .
---------------------------
Row: 8
Char: 145
Error: ')' is needed
Code: 800A03EE
---------------------------
I think the cause of problem is maxium of array buffer.
Please let me know how I do in order to edit the value "Policies".
Thank you for your kindness.