Solved

How to apply registry with logon script

Posted on 2007-03-27
5
323 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 125 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 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