Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Write an octet string to a REG_SZ value?

Status
Not open for further replies.

markdmac

MIS
Dec 20, 2003
12,340
US
Anybody have an example of how to write an octet string to a REG_SZ value?

A basic example of what I want to do:

Code:
On Error Resume Next
Const HKLM = &H80000002
strComputer = "."

Set objUser = GetObject _
    ("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")
UserGUID = objUser.objectGUID

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

strPath = "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\" & _
        "ProfileList\S-1-5-21-1443548379-341315552-1914419632-1108"

strName = "Guid"

objReg.SetStringValue HKLM, strPath, strName, UserGUID

The above appears to work, however the value in the registry displays as Chinese. Any help is greatly appreciated. This is my first time running into the octet-string and I have been unable to find any examples.

Regards,

Mark
 
OK, I realized the error in my way of searching. I was looking for a way to write the actual octet value instead of first converting it to a string. I found the conversion I needed here:


Once converted I could write the value using my code from above.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top