Visual Basic and WMI

Iratus

[H]ard|Gawd
Joined
Jan 16, 2003
Messages
1,583
Bit of a random one here but I'm trying alternate sources before spending $99 on a Experts-Exchange membership.

Does anyone have any experience of registry manipulation via wmi.
I can't use regwrite in wscript because the string is too long.

Basically what I want to do is introduce a 29 byte hex string into the registry as a reg_binary value.


Code:
Const HKEY_CURRENT_USER = &H80000001
sKey = "Session Information"
sSubkey = "Alcatel Speedtouch Connection"
vValue = "FUCKING PROBLEM"
vworkstation = "."

Set oWMIReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
vWorkstation & "\root\default:StdRegProv")

'Change Registry
oWMIReg.SetBinaryValue HKEY_Current_User, sKey, sSubKey,vValue

Basically how do I convert the hex value I get from a registry export into binary so that I can use the setbinaryvalue method without it returning the string as a bad value.

As it stands with the above code I enter single byte values fine but as I said it's 29 bytes so I'm at a loss.


Any ideas :D
 
Back
Top