Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SBS 2003 - 2008 without migration... exchange restore question 1

Status
Not open for further replies.

guitarzan

Programmer
Apr 22, 2003
2,236
US
I have a client with an SBS 2003 network (just 10 users), and will be migrating to an SBS 2008 box. Since the amount of data / resources used with it is not huge, they are considering just starting from scratch with the SBS 2008 network, have even played around with the new server, and all should work out fine... except... is it possible to get the Exchange 2003 mailboxes into Exchange 2007 on the new SBS box?

(That is, without doing a full SBS 2003 - SBS 2008 migration. The client has had some issues with the old SBS box, and is concerned that for whatever reason, the migration may fail, leaving them without a working server)
 
You are welcome. Happy to help.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
With some tweaking, I got it to work!

Quick question; appending the objRecordSet.Fields("sAMAccountName")) field did not do the trick for me; That returns the account name, but I need it to be the email address (before the @). Can that field be included in the query?

Now, I can easily create a script that manually does the above, since it is a small number of users, so I am good to go... just wondering.
 
THis version will do what you ask.
Code:
'==========================================================================
'
' NAME: FixX500.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.thespidersparlor.com[/URL]
' DATE  : 7/16/2009
' COPYRIGHT © 2009, All Rights Reserved
'
' COMMENT: Add an X500 address to a user account to ensure user can
'          reply to old mail after being moved to a new Exchange group.
'
'    THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
'    ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED To
'    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'    PARTICULAR PURPOSE.
'
'    IN NO EVENT SHALL THE SPIDER'S PARLOR AND/OR ITS RESPECTIVE SUPPLIERS 
'    BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
'    DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
'    WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
'    ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
'    OF THIS CODE OR INFORMATION.
'
'==========================================================================

On Error Resume Next

Dim qQuery, objConnection, objCommand, objRecordSet
Dim oRootDSE, strDomain, objUser, addressArray
Const ADS_PROPERTY_APPEND = 3

x500Base = "/o=ExampleAB/ou=Organizationalunit1/cn=Recipients/cn="

Set oRootDSE = GetObject("LDAP://rootDSE")
strDomain = oRootDSE.get("defaultNamingContext")

' other categories = computer, user, printqueue, group
qQuery = "<LDAP://" & strDomain &">;" & _
        "(objectCategory=person)" & _
       ";sAMAccountName,distinguishedName;subtree"

'Perform our query of AD for user objects
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Open "Provider=ADsDSOObject;"
objCommand.ActiveConnection = objConnection
objCommand.CommandText = qQuery
Set objRecordSet = objCommand.Execute

While Not objRecordSet.EOF
    'Bind to the user object
    Set objUser = GetObject("LDAP://" & objRecordSet.Fields("distinguishedName"))
    'Get the mail nickname
    addressArray = objUser.proxyAddresses
    For Each address In addressArray
    	If Left(address,5) = "SMTP:" Then
    		nicknameArray = Split(address,"@")
    		defaultSMTPNickname = Replace(nicknameArray(0),"SMTP:","")
    	End If
    Next
    
    'Add the X500 Address
    objUser.PutEx ADS_PROPERTY_APPEND, "proxyAddresses", Array("X500:" & x500Base & defaultSMTPNickname)
    objUser.SetInfo
    objrecordset.MoveNext
Wend

objConnection.Close

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top