Answered 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


All Replies

  • Thursday, March 01, 2012 12:53 PM
     
     
    have 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 PM
    Moderator
     
     Answered

    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

  • Friday, March 02, 2012 6:27 AM
     
     Answered Has Code

    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"