Re: Editing the nth byte of a BINARY Registry Value



Thank You Dan that was just what I was after

Best Regards

Gary

"Dan Khanseitov" wrote:

> Hi!
>
> Example:
>
> I need change binary value (one byte "0a" to "03" ) in key
>
> [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
>
> "DaylightStart"=hex:00,00,0a,00,05,00,03,00,00,00,00,00,00,00,00,00
>
> to the new value.
>
> Script:
>
> ****************************************************************************************
> const HKEY_LOCAL_MACHINE = &H80000002
> strComputer = "."
>
> Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
> & strComputer & "\root\default:StdRegProv")
>
> 'Define byte's array
> Dim bArray
>
> strKeyPath = "SYSTEM\CurrentControlSet\Control\TimeZoneInformation"
>
> 'Fill array with values of the key;
> 'array elemnts starts from 0 an up,
> 'so I need to change bArray(2) element's value
>
> objReg.GetBinaryValue HKEY_LOCAL_MACHINE, strKeyPath, "DaylightStart",
> bArray
>
> 'Changing value
> bArray(2) = 3
>
> 'Write infromation back
> objReg.SetBinaryValue HKEY_LOCAL_MACHINE, strKeyPath, "DaylightStart",
> bArray
>
> Set objReg = Nothing
>
>
> ****************************************************************************************
>
> Regards,
> Dan
>
> Gary wrote :
> > Hello
> >
> > I'm trying to edit a Binary Registry value which I can do by doing a full
> > replace of the data, but because the data could be different from machine to
> > machine and only specific bytes change I was trying to write a script that
> > would allow me just edit specific bytes for example byte 6 and 63, but I
> > don't know the best way to go about it.
> >
> > Could I use to the Replace function in this example?
> > Replace(reg_string, "00", "01", 63, 1, 0)
> >
> > If so would someone be able be able to help me read in a binary registry
> > value that I could run the replace on.
> >
> > I really don't have any preference how I get to how I get this to work, my
> > programming knowledge is limited so any advice or help would be most
> > appreciated.
> >
> > Thanks for time
> >
> > Gary
> >
> > PS My reference to a byte is if you export out from the registery a binary
> > value
> > eg "1"=hex:03,00,00,00,00,00,00,
> >
> > I'm asuming that the number inbetween the coma's represets a byte and I've
> > worked out byte's that I would need to change.
> >
> > Please feel free to tell me if i'm being a doughnut
>
>
>
.



Relevant Pages

  • RE: local admin account password
    ... environment, yes we may have these, but we still use the same methods. ... With regards to the script, this script is actually run from a secured ... The local passwords are secured both in a secure password ...
    (Focus-Microsoft)
  • Re: Memory consumption PowerShell
    ... Why need a running CMD.Exe on Windows Server 2003 only 144 KB??? ... With best regards ... And we could initiate to run a script oout side the IDN 3.0. ... memory. ...
    (microsoft.public.windows.server.scripting)
  • Re: Clearing down IE temp files, the easy way??
    ... but i use a script which sets the registry key and it works fine. ... Best regards ... Disclaimer: This posting is provided "AS IS" with no warranties, ...
    (microsoft.public.windows.terminal_services)
  • Re: [opensuse] Installation methods
    ... >> Regards, Rajko. ... I downloaded a script yesterday. ... So I should have ran "chmod 777 ... I also ran the chmod command for yet another program I was attempting to ...
    (SuSE)