Scripting the windows registry (wmi/vbscript)

  • Hey - turns out IRC is out and something a little more modern has taken it's place... A little thing called Discord!

    Join our community @ https://discord.gg/JuaSzXBZrk for a pick-up game, or just to rekindle with fellow community members.

dog

Make the pie higher!!!
Jun 8, 2001
4,239
0
2ft. infront of you
Anyone here who have any experience in scripting the windows registry?

Basically I have to make a script that will:

check the existence of a key:

if key exists:
check usergroup has read/write access
if not grant it
else
create empty key
modify permissions (see above)
end if


The short of the long is that m$ has made a err in 2k pro, which renders users unable to use citrix wan client 7.0+. The HKLM\Software\Micro...\MSLicensing key needs to allow either domain users or authenticated users read/write access, and does not by default. I have to distribute a cd to a shitload of users, I can't directly support. So I figured I could script my way out and correct the err, prior to installing the client. The problem is, I can not find a way to check for a specified usergroups permission in the registry, only as the current user, which doesn't help much, as they would most likely install as admin or a equiv. Since I can't guarantee they will be using a domain, I want to provide authenticated users the rights needed.

So far what I have is:

Code:
Set objShell = CreateObject("WScript.Shell")
objShell.Exec "%comspec% /k reg.exe SAVE HKLM/SOFTWARE/Microsoft/MSLicensing mslicensing.hiv"

' Et par constants og variables:
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
strKeyPath = "SOFTWARE\Microsoft\MSLicensing"
strEntryName = ""
Set ObjReg = GetObject("winmgmts:{impersonationLevel = impersonate}!\\" & _
    strComputer & "\root\default:StdRegProv")

varMSLicensing = objReg.GetStringValue(HKEY_LOCAL_MACHINE, strKeyPath, strEntryname)

	If varMSLicensing <> 0 then

	Elseif varMsLicensing = 0 then
		ObjReg.Createkey(HKEY_LOCAL_MACHINE, strKeyPath)

	End if

But as is quite evident, the crucial bits are missing ;)
EDIT: Clarifying.
 
Last edited: