HKCU Custom Task - Read append write registry

(imported topic written by StanZ)

Hello,

I am knew but i have an issue, can you please take a look at my script regarding reading, appending and deploying a registry value for a string? We are trying to append a proxyoverride on IE for current users on the machines. I am not sure regarding the execution on Execute as current user part.

createfile until EOF

Set objShell = WScript.CreateObject(“WScript.Shell”)

sngVersion = objShell.RegRead(“HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyOverride”)

if ( InStr(sngVersion,"*.something.com;") < 1 ) Then

            sngVersion = "*.something.com;" & sngVersion



            objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyOverride", sngVersion, "REG_SZ"

End If

EOF

delete temp.vbs

move __createfile temp.vbs

waithidden __Download\RunAsCurrentUser.exe --w cmd.exe /c cscript temp.vbs

(imported comment written by BrianPGreen)

One problem that I can see with this script is that it tries to run “RunAsCurrentUser.exe” in the download folder without first downloading it. I think you have to add a ‘prefetch’ line to your script to make sure that you first have RunAsCurrentUser.exe before trying to run it.

(imported comment written by jgstew)

So this is a per-user setting? You cannot write it to HKLM instead?

Is this something that should be written to all users, or just the current user? Why not use a GPO for this?

I think I have an example of how to do something similar without using .vbs or RunAsCurrentUser, but I’ll need to dig it up.

(imported comment written by jgstew)

These are the examples I was thinking of:

http://bigfix.me/fixlet/details/718

http://bigfix.me/fixlet/details/645

(imported comment written by jvdh11)

Here’s an example of what I built recently

regset “[HKEY_USERS{component string of sid of security account (string value of selects “Username from Win32_ComputerSystem” of wmi)}\Software\Microsoft\Windows\CurrentVersion\Internet Settings]” “ProxyOverride”=“list the override sites here”

(imported comment written by jgstew)

Could do it this way:

(component string of sid of security account (name of current user))