Configure Outlook Exchange email account through login script
This one’s a common issue – you’ve got hundreds of users and want an efficient way of handing out Exchange email account settings to all of your Outlook users. Well, I’m going to cut through all the waffle and tell you the method I use.
I create a .prf file (Outlook Profile), store it in a shared server location, and reference it from within a login script. The problem is, I only want it to run once (when a user logs into a machine for the first time). So I check for the existence of a junk file in the users profile directory (C:\Doc & Set\user\outlookdone.dat – which incidentally also contains the date it was originally done). The resulting login batch file looks a bit like this:
if exist “%USERPROFILE%\outlookdone.dat” goto outlookdone
echo Configuring Outlook EMail profile..
“c:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE” /importprf \\server\share\outlook.prf
echo %date% >”%USERPROFILE%\outlookdone.dat”: outlookdone
(NB: that this is for Outlook 2003 – OFFICE11. This method should also work for 2002 and 2007 – however it has not been tested). Finally, the all important .prf file looks a bit like this:
[General]
Custom=1
ProfileName=Default profile
DefaultProfile=Yes
OverwriteProfile=No
ModifyDefaultProfileIfPresent=FALSE[Service List]
;ServiceX=Microsoft Outlook Client
ServiceEGS=Exchange Global Section
Service1=Microsoft Exchange Server
ServiceEGS=Exchange Global Section[ServiceEGS]
MailboxName=%UserName%
HomeServer=YOUREXCHANGESERVERNAMEGOESHERE
[Service1]
OverwriteExistingService=No
UniqueService=Yes
MailboxName=%UserName%
HomeServer=YOUREXCHANGESERVERNAMEGOESHERE
AccountName=Microsoft Exchange Server[Microsoft Exchange Server]
ServiceName=MSEMS
MDBGUID=5494A1C0297F101BA58708002B2A2517
MailboxName=PT_STRING8,0×6607
HomeServer=PT_STRING8,0×6608
OfflineAddressBookPath=PT_STRING8,0x660E
OfflineFolderPath=PT_STRING8,0×6610[Exchange Global Section]
SectionGUID=13dbb0c8aa05101a9bb000aa002fc45a
MailboxName=PT_STRING8,0×6607
HomeServer=PT_STRING8,0×6608
RPCoverHTTPflags=PT_LONG,0×6623
RPCProxyServer=PT_UNICODE,0×6622
RPCProxyPrincipalName=PT_UNICODE,0×6625
RPCProxyAuthScheme=PT_LONG,0×6627
CachedExchangeConfigFlags=PT_LONG,0×6629[Microsoft Mail]
ServiceName=MSFS
ServerPath=PT_STRING8,0×6600
Mailbox=PT_STRING8,0×6601
Password=PT_STRING8,0x67f0
RememberPassword=PT_BOOLEAN,0×6606
ConnectionType=PT_LONG,0×6603
UseSessionLog=PT_BOOLEAN,0×6604
SessionLogPath=PT_STRING8,0×6605
EnableUpload=PT_BOOLEAN,0×6620
EnableDownload=PT_BOOLEAN,0×6621
UploadMask=PT_LONG,0×6622
NetBiosNotification=PT_BOOLEAN,0×6623
NewMailPollInterval=PT_STRING8,0×6624
DisplayGalOnly=PT_BOOLEAN,0×6625
UseHeadersOnLAN=PT_BOOLEAN,0×6630
UseLocalAdressBookOnLAN=PT_BOOLEAN,0×6631
UseExternalToHelpDeliverOnLAN=PT_BOOLEAN,0×6632
UseHeadersOnRAS=PT_BOOLEAN,0×6640
UseLocalAdressBookOnRAS=PT_BOOLEAN,0×6641
UseExternalToHelpDeliverOnRAS=PT_BOOLEAN,0×6639
ConnectOnStartup=PT_BOOLEAN,0×6642
DisconnectAfterRetrieveHeaders=PT_BOOLEAN,0×6643
DisconnectAfterRetrieveMail=PT_BOOLEAN,0×6644
DisconnectOnExit=PT_BOOLEAN,0×6645
DefaultDialupConnectionName=PT_STRING8,0×6646
DialupRetryCount=PT_STRING8,0×6648
DialupRetryDelay=PT_STRING8,0×6649[Personal Folders]
ServiceName=MSPST MS
Name=PT_STRING8,0×3001
PathToPersonalFolders=PT_STRING8,0×6700
RememberPassword=PT_BOOLEAN,0×6701
EncryptionType=PT_LONG,0×6702
Password=PT_STRING8,0×6703[Unicode Personal Folders]
ServiceName=MSUPST MS
Name=PT_UNICODE,0×3001
PathToPersonalFolders=PT_STRING8,0×6700
RememberPassword=PT_BOOLEAN,0×6701
EncryptionType=PT_LONG,0×6702
Password=PT_STRING8,0×6703[Outlook Address Book]
ServiceName=CONTAB[LDAP Directory]
ServiceName=EMABLT
ServerName=PT_STRING8,0×6600
UserName=PT_STRING8,0×6602
UseSSL=PT_BOOLEAN,0×6613
UseSPA=PT_BOOLEAN,0×6615
DisableVLV=PT_LONG,0×6616
DisplayName=PT_STRING8,0×3001
ConnectionPort=PT_STRING8,0×6601
SearchTimeout=PT_STRING8,0×6607
MaxEntriesReturned=PT_STRING8,0×6608
SearchBase=PT_STRING8,0×6603[Microsoft Outlook Client]
SectionGUID=0a0d020000000000c000000000000046
FormDirectoryPage=PT_STRING8,0×0270
WebServicesLocation=PT_STRING8,0×0271
ComposeWithWebServices=PT_BOOLEAN,0×0272
PromptWhenUsingWebServices=PT_BOOLEAN,0×0273
OpenWithWebServices=PT_BOOLEAN,0×0274
CachedExchangeMode=PT_LONG,0x041f
CachedExchangeSlowDetect=PT_BOOLEAN,0×0420[Personal Address Book]
ServiceName=MSPST AB
NameOfPAB=PT_STRING8,0x001e3001
Path=PT_STRING8,0x001e6600
ShowNamesBy=PT_LONG,0×00036601; ************************************************************************
; Section 7 – Mapping for internet account properties. DO NOT MODIFY.
; ************************************************************************[I_Mail]
AccountType=POP3
;— POP3 Account Settings —
AccountName=PT_UNICODE,0×0002
DisplayName=PT_UNICODE,0x000B
EmailAddress=PT_UNICODE,0x000C
;— POP3 Account Settings —
POP3Server=PT_UNICODE,0×0100
POP3UserName=PT_UNICODE,0×0101
POP3UseSPA=PT_LONG,0×0108
Organization=PT_UNICODE,0×0107
ReplyEmailAddress=PT_UNICODE,0×0103
POP3Port=PT_LONG,0×0104
POP3UseSSL=PT_LONG,0×0105
; — SMTP Account Settings —
SMTPServer=PT_UNICODE,0×0200
SMTPUseAuth=PT_LONG,0×0203
SMTPAuthMethod=PT_LONG,0×0208
SMTPUserName=PT_UNICODE,0×0204
SMTPUseSPA=PT_LONG,0×0207
ConnectionType=PT_LONG,0x000F
ConnectionOID=PT_UNICODE,0×0010
SMTPPort=PT_LONG,0×0201
SMTPUseSSL=PT_LONG,0×0202
ServerTimeOut=PT_LONG,0×0209
LeaveOnServer=PT_LONG,0×1000[IMAP_I_Mail]
AccountType=IMAP
;— IMAP Account Settings —
AccountName=PT_UNICODE,0×0002
DisplayName=PT_UNICODE,0x000B
EmailAddress=PT_UNICODE,0x000C
;— IMAP Account Settings —
IMAPServer=PT_UNICODE,0×0100
IMAPUserName=PT_UNICODE,0×0101
IMAPUseSPA=PT_LONG,0×0108
Organization=PT_UNICODE,0×0107
ReplyEmailAddress=PT_UNICODE,0×0103
IMAPPort=PT_LONG,0×0104
IMAPUseSSL=PT_LONG,0×0105
; — SMTP Account Settings —
SMTPServer=PT_UNICODE,0×0200
SMTPUseAuth=PT_LONG,0×0203
SMTPAuthMethod=PT_LONG,0×0208
SMTPUserName=PT_UNICODE,0×0204
SMTPUseSPA=PT_LONG,0×0207
ConnectionType=PT_LONG,0x000F
ConnectionOID=PT_UNICODE,0×0010
SMTPPort=PT_LONG,0×0201
SMTPUseSSL=PT_LONG,0×0202
ServerTimeOut=PT_LONG,0×0209
CheckNewImap=PT_LONG,0×1100
RootFolder=PT_UNICODE,0×1101[INET_HTTP]
AccountType=HOTMAIL
Account=PT_UNICODE,0×0002
HttpServer=PT_UNICODE,0×0100
UserName=PT_UNICODE,0×0101
Organization=PT_UNICODE,0×0107
UseSPA=PT_LONG,0×0108
TimeOut=PT_LONG,0×0209
Reply=PT_UNICODE,0×0103
EmailAddress=PT_UNICODE,0x000C
FullName=PT_UNICODE,0x000B
Connection Type=PT_LONG,0x000F
ConnectOID=PT_UNICODE,0×0010
Did you find this hint useful? Are you looking to learn more? Well, here’s a few books that I’ve found useful – have a goosie!
![]() Mastering Microsoft Exchange Server 2003 |
![]() Microsoft Windows Shell Script Programming |
![]() Microsoft Windows Script Host |
![]() Active Directory for Dummies |





