?
Solved

How to apply registry with logon script

Posted on 2007-03-27
5
Medium Priority
?
325 Views
Last Modified: 2011-10-03
I'd like to apply the following registry with vbs on particular OU.
Since this is under HKCU should be ran as logon script.

http://support.microsoft.com/kb/319206/en-us
HKEY_CURRENT_USER\Software\Microsoft\Exchange\Exchange Provider
Value name: Closest GC
Data type: REG_DWORD
Radix: Hexadecimal
Value data: 0x00000001

Script has to determine if this registry is already exists, and if so should skip the process because I don't want to re-apply the registry.
Please help. I'm not good at scripting.
0
Comment
Question by:kimakabane
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18799006
This should do it...

Const HKEY_CURRENT_USER = &H80000001
 
Dim objReg:Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Exchange\Exchange Provider"
strValueName = "Closest GC"
oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,strValue
If strValue="" Then
  objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath, strValueName, 1
End If
Set objReg=Nothing


0
 

Author Comment

by:kimakabane
ID: 18799144
Hi,

I copy pasted the script and create .vbs but nothing has created under the key.
Also I had to correct
oReg.GetDWORDValue
to
objReg.GetDWORDValue
I think this is just a typo.

No error message, but nothing created. I'm sure that I have local admin rights.
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18799234
Change the "IF" to this...
If IsNull(strValue) Then
0
 

Author Comment

by:kimakabane
ID: 18799415
worked... Thanks!
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18799419
:^)
Happy to help!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question