Hi,

I am trying to add a threshold value to HKCU through a script. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings , i need to create the value name Receivetimeout and give the valuedata . I tried the runonce script, it works as a admin, but fails for a locked down user. Here is the script, please tell me if I need to make any changes.

Runonce Script:

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
strValueName = "ReceiveTimeout"
strValue = "C:\Applications\BusinessObjects\ReceiveTimeout.vbs"
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue

 

the Receivetimeout.vbs contains

Option Explicit
Dim WSHShell, RegKey
set WSHShell = CreateObject("WScript.Shell")
RegKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\"
WSHShell.RegWrite RegKey & "Receive Timeout", 3600000, "REG_DWORD"

'WScript.Echo WSHShell.RegRead(RegKey & "Receive Timeout")

Please let me know, if I am wrong somewhere.

Thanks

Answer Summary:
Either do it through an MSI, or add an equivalent key in HKCU through Active Setup.
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

4

It makes sense for the RunOnce script not to work for a locked down user, since you're trying to write a HKLM registry key.

Using either runonce or ActiveSetup, you'll always need to run the script that puts everything in place as an admin once on each machine. The script that gets triggered (receivetimeout.vbs) then runs for each user

In finishing, using the runonce key like this is not a good solution for your problem, since the receivetimeout.vbs will only run once the next time a user logs in, an not for each user.

Answered 05/02/2012 by: pjgeutjens
Red Belt

Please log in to comment

Answers

1

Push the run once script using admin\system account how are you deploying this?

Answered 05/02/2012 by: GAKIS
Second Degree Green Belt

  • I am deploying through Radia. I have given radia the rights for it to install anything as an admin.
Please log in to comment
1

Is there any other method I can add those registries. Please help.

Answered 05/03/2012 by: shamu99
Fifth Degree Brown Belt

Please log in to comment
1

Run Once or Active setup key will not be able to perform any task which require elevated privileges. So either do it through MSI or add an equivalent key in HKCU through Acrive Setup.

Answered 05/03/2012 by: piyushnasa
Red Belt

  • Thanks so much, your method worked :)
Please log in to comment
1

A great way to push registry keys is to grab one of the simple Microsoft Fix It solutions and modify it with ORCA.

http://support.microsoft.com/kb/255905

 

Answered 05/04/2012 by: philologist
Red Belt

Please log in to comment
0

Thanks all,

I tried piyushnasa method. it worked :)

Answered 05/09/2012 by: shamu99
Fifth Degree Brown Belt

Please log in to comment
Answer this question or Comment on this question for clarity