WshShell.RegWrite
"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState",
0c0002001b01e77760000000 "REG_DWORD"
I'm having trouble with the hex syntax. Would anyone know how to write this
correctly?
Thanks
--
-Maro
This doc will show you how to write values to the registry using WMI,
instead of the the standard regwrite statements. I've found this
methodology to be more powerful.
"Christoph Basedau" <e_t...@hotmail.com> wrote in message
news:438ce581$0$20859$9b4e...@newsread2.arcor-online.net...
> '0c0002001b01e77760000000' is far too big for a DWORD.
> DWORD is a 32 bit unsigned long, whose max-value is
> 'FFFFFFFF' or 4,294,967,295 [Hex/Decimal].
> Numbers from 2^32 on need to be written as REG_BINARY; Writting Binary
> Values
> needs a different API then WSHShell.RegWrite, for example
> StdRegProv.SetBinaryValue.
> Also you either need to carefully build a variant array from the string or
> use
> a third party component for creating a binary-array from string, like e.g.
> 'ADs.ArrayConvert', which you can download here:
>
> http://support.microsoft.com/kb/q250344/
>
>
> Dim regPath
> Dim strValue
> Dim binArray
>
> Const HKEY_CURRENT_USER = &H80000001
>
> regPath =
> "Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState"
> binArray = Array(&Hc, &H0, &H2, &H0, &H1B, &H1, &HE7, &H77, &H60, &H0,
> &H0, &H0)
>
> ''alternatively create the binArray by component:
> 'Dim oCnvt
> 'Set oCnvt = CreateObject("ADs.ArrayConvert")
> 'binArray = oCnvt.CvHexStr2vOctetStr("0c0002001b01e77760000000")
>
> Set oStdRegProv = GetObject("Winmgmts:root\default:StdRegProv")
>
> Return = oStdRegProv.SetBinaryValue(HKEY_CURRENT_USER, _
> regPath, _
> "", _
> binArray )
>
> If (Return = 0) And (Err.Number = 0) Then
> Wscript.Echo "Binary value added successfully"
> Else
> Wscript.Echo "An error occurred"
> End If
>
>
>
>
>
> --
> Gruesse, Christoph
>
> Rio Riay Riayo - Gordon Sumner, 1979
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegProvider =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer &
"\root\default:StdRegProv")
regPath = "Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState"
regValueName = "Settings"
binValueData = Array(&HC, &H0, &H2, &H0, &H1B, &H1, &HE7, &H77, &H60, &H0,
&H0, &H0)
objRegProvider.SetBinaryValue HKEY_CURRENT_USER, regPath, regValueName,
binValueData
Thanks for the help
--
-Maro