/build/static/layout/Breadcrumb_cap_w.png

Adding DWORD

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


0 Comments   [ + ] Show comments

Answers (6)

Answer Summary:
Either do it through an MSI, or add an equivalent key in HKCU through Active Setup.
Posted by: pjgeutjens 11 years ago
Red Belt
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.

Posted by: piyushnasa 11 years ago
Red Belt
2

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.


Comments:
  • Thanks so much, your method worked :) - shamu99 11 years ago
Posted by: GAKIS 11 years ago
Fourth Degree Green Belt
1

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


Comments:
  • I am deploying through Radia. I have given radia the rights for it to install anything as an admin. - shamu99 11 years ago
Posted by: shamu99 11 years ago
Fifth Degree Brown Belt
1

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

Posted by: philologist 11 years ago
Red Belt
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

 

Posted by: shamu99 11 years ago
Fifth Degree Brown Belt
0

Thanks all,

I tried piyushnasa method. it worked :)

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ