In Windows 8.1, I cannot set a binary value in HKLM, but can in HKCU - this example script demonstrating the issue and is derived from http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/24/how-can-i-write-binary-data-to-the-registry.aspx
const HKEY_CURRENT_USER = &H80000001 const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set objRegistry = GetObject _ ("winmgmts:\\" & strComputer & "\root\default:StdRegProv") strKeyPath = "Software" strValueName = "BinaryTest" arrValues = Array(1,2,3,4,5,6,7,8,9,10) errReturn = objRegistry.SetBinaryValue(HKEY_CURRENT_USER, strKeyPath, strValueName, arrValues) If errReturn = 0 Then Wscript.Echo "Worked in HKCU." Else WScript.Echo "Failed in HKCU" End If errReturn = objRegistry.SetBinaryValue(HKEY_LOCAL_MACHINE, strKeyPath, strValueName, arrValues) If errReturn = 0 Then Wscript.Echo "Worked in HKLM." Else WScript.Echo "Failed in HKLM. Return code: " & errReturn End If
The return value on failure is 5. Script is running with Administrative rights.
- Edited by StuartDunkeld Saturday, February 07, 2015 4:00 PM edit