Change the Registry Key
-
Thursday, March 01, 2012 11:50 AM
Hi Guys!
I need a big help !
I have this script that changes a registry key, (ok!), but is not default on the machines, because the name changes according to the login of the person.
Do you can make a script to change this path?
'
'
'
'
'Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Rafael Amaral\13dbb0c8aa05101a9bb000aa002fc45a"
strValueName = "001e6612"
strValue = "/o=VDC/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=VDCSRV81"
objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue'
'
'
'
'Thankful!
Rafael S. AMARAL
- Edited by Rafael S. AMARAL Thursday, March 01, 2012 11:59 AM
All Replies
-
Thursday, March 01, 2012 12:53 PMhave you tried looking at using the %username% environment variable to grab the current logged in user?
- Edited by thepip3r Thursday, March 01, 2012 2:03 PM
-
Thursday, March 01, 2012 3:20 PMModerator
Hi,
If I understand your intent, you're trying to make a change in HKEY_CURRENT_USER for a user's MAPI (Outlook) profile.
IIRC, you can find out the current user's default MAPI profile by reading the following registry value:
Hive: HKEY_CURRENT_USER
Subkey: Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles
Value name: DefaultProfile (REG_SZ)Otherwise you will need to specify the MAPI profile name, which can really be anything. The profile names are the subkey names of the Profiles subkey listed above.
HTH,
Bill
- Proposed As Answer by Richard MuellerMVP, Moderator Thursday, March 08, 2012 1:58 AM
- Marked As Answer by Rafael S. AMARAL Thursday, March 08, 2012 1:31 PM
-
Friday, March 02, 2012 6:27 AM
Also what you can do is run the reg add command:
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\%username%\13dbb0c8aa05101a9bb000aa002fc45a" /v Path /t REG_SZ /d "/o=VDC/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=VDCSRV81"
- Edited by Jaap Brasser Friday, March 02, 2012 6:27 AM code block:(
- Proposed As Answer by Richard MuellerMVP, Moderator Thursday, March 08, 2012 1:58 AM
- Marked As Answer by Rafael S. AMARAL Thursday, March 08, 2012 1:32 PM

