Solved

Changing the Microsoft Exchange Server name Automatically

Posted on 2004-03-29
3
1,738 Views
Last Modified: 2012-08-14
Hello.

I am looking to change the Exchange Server name automatically, probably using VBA code. I am talking about when you:

1. right-click on your desktop "Outlook" icon, select properties
2. select "Microsoft Exchange Server" from the "Services" tab and click on properties
3. changing the "Microsoft Exchange Server" name on the top line

Can anyone help?

Thx,

Clayton
0
Comment
Question by:Snakie1066
3 Comments
 
LVL 2

Accepted Solution

by:
wescojohn earned 250 total points
ID: 10717964
'This will enumerate through the registry and change the Exchange Server data for a user

On Error Resume Next

const HKEY_CURRENT_USER = &H80000001

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_

".\root\default:StdRegProv")

Set StdOut = WScript.StdOut

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\"

oReg.EnumKey HKEY_CURRENT_USER, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
            expStrKeyPath = strKeyPath & subkey & "\"
            oReg.EnumKey HKEY_CURRENT_USER, expStrKeyPath, arr2SubKeys

            For Each subkey2 In arr2SubKeys

                        expStrKeyPath2 = expStrKeyPath & subkey2
            If Right(expStrKeyPath2,32) = "13dbb0c8aa05101a9bb000aa002fc45a" Then

            Dim Path
            Path = "HKCU\" & expStrKeyPath2 & "\"
Set WSHShell = Wscript.CreateObject("WScript.Shell")
ServerName = "NewServerName"
OldServer = "OldServerName"

'this fills the sub key with the value of new server and specifies that it is a regular string

KeyExist = WSHShell.RegRead(path & "001e6608")

 If KeyExist = ServerName Then

 Wscript.Quit

 ElseIf Ucase(KeyExist) <> OldServerName Then

 MsgBox "Unexpected Exchange Settings.  Please contact the help desk"

 Wscript.Quit

 ElseIf Ucase(KeyExist) = OldServerName Then

            WSHShell.RegWrite path & "001e6608",ServerName,"REG_SZ"

            WSHShell.RegWrite path & "001e6602",ServerName,"REG_SZ"

 End If


If err then

 msgbox "Error Encountered Changing Exchange Server Name" & vbCrLf & "Please contact the help desk."

else

 Wscript.Quit

End if
Wscript.Quit
            End If
            Next
Next
0
 

Author Comment

by:Snakie1066
ID: 10718299
Perfect. This answer was just what I was looking for. Thanks very much.
0
 
LVL 23

Expert Comment

by:Justin Durrant
ID: 13793936
I tried to run this and I get this error:

C:\>cscript update.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

C:\update.vbs(6, 1) Microsoft VBScript compilation error: Syntax error


C:\>


Code:



On Error Resume Next

const HKEY_CURRENT_USER = &H80000001

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_

".\root\default:StdRegProv")

Set StdOut = WScript.StdOut

strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\"

oReg.EnumKey HKEY_CURRENT_USER, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
            expStrKeyPath = strKeyPath & subkey & "\"
            oReg.EnumKey HKEY_CURRENT_USER, expStrKeyPath, arr2SubKeys

            For Each subkey2 In arr2SubKeys

                        expStrKeyPath2 = expStrKeyPath & subkey2
            If Right(expStrKeyPath2,32) = "13dbb0c8aa05101a9bb000aa002fc45a" Then

            Dim Path
            Path = "HKCU\" & expStrKeyPath2 & "\"
Set WSHShell = Wscript.CreateObject("WScript.Shell")
ServerName = "NFDNT004"
OldServer = "SVMAILNF"

'this fills the sub key with the value of new server and specifies that it is a regular string

KeyExist = WSHShell.RegRead(path & "001e6608")

 If KeyExist = ServerName Then

 Wscript.Quit

 ElseIf Ucase(KeyExist) <> OldServerName Then

 MsgBox "Unexpected Exchange Settings.  Please contact Justin or John"

 Wscript.Quit

 ElseIf Ucase(KeyExist) = OldServerName Then

            WSHShell.RegWrite path & "001e6608",ServerName,"REG_SZ"

            WSHShell.RegWrite path & "001e6602",ServerName,"REG_SZ"

 End If


If err then

 msgbox "Error Encountered Changing Exchange Server Name" & vbCrLf & "Please contact the help desk."

else

 Wscript.Quit

End if
Wscript.Quit
            End If
            Next
Next


Any idas?
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
OWA address for sennatech.sg domain 6 35
Outlook.com timing out while writing email 4 39
forgot pst password 2 38
restore emails from public folder 2 9
Resolve Outlook connectivity issues after moving mailbox to new Exchange 2016 server
Find out what you should include to make the best professional email signature for your organization.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

947 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now