Automatically create Outlook user profiles on login

ksilvoso used Ask the Experts™
We have Exchange 2003 with Windows Xp clients running Office 2003. We install Office thru an admin share on a file server and that works fine. We use scripts to map drives and add printers but up to now we have had to manually add each users Outlook profile to any PC that they want to use. I would like to automate that. I downloaded Office 2003 Resource Toolkit and used the Custom Maint. Wizard to create a .cmf file that, near as I can tell, contains some Outlook settings that we want to use and our Exchange server name. I have copied maintwiz.exe and .cmf to the same folder as the admin install but now I am stuck.

What is the best way to apply the settings the first time a user logs on to a particular PC? All these PCs will have Office fully installed, I just want to configure the Outlook profile to get the username and exchange server name.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hi Ksilvoso

Actually not sure what a cmf file is, can I assume you mean a PRF file?  Here is how I do it.

Download Microsoft Office 2003 Resource Kit ( I assume 2003)

Install this and then run Microsoft Office 2003 Customisation Wizard, follow the steps until you get to the step about creating a PRF file, go through and customise your settings and than save your PRF file.

Now Open the PRF file and add BackupProfile=No (see below)

Now you can push this out to all your clients via login script or a shortcut with the following command.

Outlook.exe /importPRF \\Server\Share\Outlook.PRF

All Done.  Cheers

;Automatically generated PRF file from the Microsoft Office Customization and Installation Wizard

; **************************************************************
; Section 1 - Profile Defaults
; **************************************************************



I had installed the 2003 Microsoft Office 2003 Resource Kit. When I run the Custom Istallaltion Wizard it creates a .mst file: "setup.exe TRANSFORMS=R:\Install\Office2003Admin\NewSetupFile.MST /qb-". I originally created a .cmf file using the Custom Maintenance Wizard. I can get it to create an Outloook profile and connect as the user to our exchange server by running "r:\install\Office2003Admin\MaintWiz.exe /c "r:\install\Office2003Admin\NewOutlookUserLogonFile.CMW" /qb-". The "r:\install\Office2003Admin" location is a shared folder on a file server where I did an admin install of Office 2003. I put that line in a batch file, click it and it setups up the profile. My problem is how do I get it to run once and only once the first time someone logs on to a particular PC.

Nowhere did I see that option to create a .prf file, altho the wizard did ask about importing info from one.
Hi ksilvoso

As I said above using PRF files is the correct method for creating Users Profiles
Please try the following
Run the Custom Installation Wizard look at Steps 17 - Outlook: Customize Default Profile
Select New Profile
Type: CustomProfile - this can be anything you like.
Click Next
Select Configure an Exchange Server connection
Type: %Username% - Username Field
Type: \\Exchange\
The rest is optional for e.g.
Click Configure Cached Exchange Mode
Check Use Cached Exchange Mode
Select Download full items
Check On slow connections download only headers
Check Download Public Folder Favorites
Click Next
Select Do not customize Outlook profile and account information - Default
Click Next
Click Export Profile Button
Save the Profile on \\Server\Share\ Call it Outlook.PRF - Or what ever you like
You can now close the Custom Installation Wizard
Navigate to \\Server\Share\Outllook.PRF and edit with NotePad
Add the BackupProfile=No (See my first post)
Save it
Within Logon Script Add the following
if exist "%ProgramFiles%\Microsoft Office\OFFICE11\Outlook.exe" Outlook.exe /ImportPRF \\Server\Share\Outlook.PRF

If you want to use the Maintenance Wizard method you could also add this to the Logon Script, however I wouldn't use Map Drive Letters use UNC



So close... I got the prf file created, modified it like you show in the first post and have added it to my login script but it causes the script to hang. The Outlook profile is created, Outlook launches but the script stops working until you close Outlook. After Outlook is closed the script finishes then exits. Either I need Outlook to setup then close or find some switch to keep the logon script running to completion if Outlook is opened and configured by the prf file

Ok what happens if you just double click the PRF file, this should import the settings as well.  Can you tell me if it's hanging? there as well.

Also here's more information about PRFs



I ran the pfr file from the shared drive and it gives a warning about overwriting current settings which would freak out most users so unless there is a quiet mode to go with that that is not an option. However, Outlook did configure properly when I ran the prf file.

I don't think the problem is that Outlook is hanging when I run the prf thru the login script, it seems like the script hangs after Outlook finishes its configuation.  If I let Outlook finish the setup then close it the logon script continues on to the end properly, but as long as Outlook is open thes script hangs. Also, the prf file runs every time when I use the ifexst script you gave me. I need something that will run one time. Perhaps using 'if not exist' and look for a folder that Outlook creates under Documents and Settings the first time it is configured...
You could use the following: (for new users only)

IF EXIST "%appdata%\Microsoft\Office\MSOut11.pip" GOTO :Next
START "" "%ProgramFiles%\Microsoft Office\OFFICE11\OUTLOOK.EXE" /importprf "\\SERVER\SHARE\Outlook.prf"


or Create your own file to search for e.g.

IF EXIST "%appdata%\Microsoft\OUTLOOK\OUTPRF.SET" GOTO :Next
START "" "%ProgramFiles%\Microsoft Office\OFFICE11\OUTLOOK.EXE" /importprf "\\SERVER\SHARE\Outlook.prf">>"%appdata%\Microsoft\OUTLOOK\OUTPRF.SET"


Alternatively if you want this to occur when the user first starts Outlook than you could use the following:
Create a OUTLOOK.reg file using the following:


Then use the following within the logon script:

IF EXIST "%appdata%\Microsoft\OUTLOOK\OUTPRF.SET" GOTO :Next


Hope that makes sense, you can chop and change etc.. as you see fit.



The first solutiion works fine. I had to put the prf file on a network share that everyone can get to but it seems to be working fine. Thanks.

Hi I went with the first part of the matrixnz soltuion (for new users only) and it worked a dream. I had the same problems, created the prf etc fine but it was hanging after the profile loaded. thanks for your help

hey there,

Ive created a PRF and it works fine when i run it on a machine which i havnt logged onto before:

Example: i just open the the PRF file in the Network folder just to test does it work,
it installs when i run. and get all my mail.

Now heres my probelm..

I wanta make this automatic for the users,  i was thinking using group policy.

User Config...\Admin...Templates\Sys...\Run Theses Programs at User Logon

Than running the prf file so it opens each time a user logs on


...see i'd like to have it run only if the users have not got their mail on that pc before
Hi ali678

If you note my last post, you can use logon script from within Group Policy and just use a batch as I described in that post, so basically you check if a file exists or not, if it exists than the PRF has previously been imported, if it doesn't exist then it means that it hasn't been run before.

IF EXIST "%appdata%\Microsoft\OUTLOOK\OUTPRF.SET" GOTO :Next
START "" "%ProgramFiles%\Microsoft Office\OFFICE11\OUTLOOK.EXE" /importprf "\\SERVER\SHARE\Outlook.prf">>"%appdata%\Microsoft\OUTLOOK\OUTPRF.SET"



Thanks thats brill:)

 i'll try that in work tomorrow :)

OK im back:)

Ive written a script to run my prf on all the users machines in the place. I Copy the prf to a file called
EmailConfig2. This will tell me if they have installed the profile the next time. Baiscally means that outlook wont open and annoy people who have it set up.

Heres the batch file thats in a group policy

IF EXIST "C:\EmailConfig2\Test5.prf" GOTO : Next
cmd.exe /c md c:\EmailConfig2
XCOPY "\\eucs1\software\MS Office Pro 2003\Prfs\*.*" "C:\EmailConfig2"
START "" "C:\EmailConfig2\test5.prf"

Ok my problem:
Lets say im a first time user when i log on mircosoft outlook opens up, however i get this message

"Outlook is about to import information into your E-mail Accounts. This can potenially modify or replace your existing email account settings would you like to import"

Is there a way to make that message not come up?

And also my boss was talking about making the confirguarion of the email not involve opening outlook, kinda have it done without the users knowledge...can that be done?

Thanks a million:)

sorry i didnt read above
Here is the best method now this method basically will remove any existing profile and force all users to use the same profile, this way we know that there is no differences.

Step 1:
Edit the ProfileName in your PRF file as follows:
Note: PRFDefault is an example, it doesn't really matter but try to make it without spaces and short.


Save the file as PRFDefault.PRF

Step 2
Now the following can be done in VB however I'm a big fan of AutoIT so this is what I'd use.

Download and install AutoIT Version 3
AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting.

Also recommend downloading and installing Scite Editor for AutoIT

Step 3
Open Scite and Copy and Paste the Code Below.
Save as PRFDefault.AU3 inside the same directory as the 'PRFDefault.PRF' file
Right Click the PRFDefault.AU3 and select Compile
Double click to test.

You can use this from a login script, however note if you're users aren't members of the local Administrators Group you will need to change the path to where the PRFDefault.PRF is copied to in the script below.


;Default PRF File Name - Change if your PRF is named different
;Path to where the PRFDefault.PRF File is Saved - Change if in different location, remember to insert a backslash at the end '\'
$DIR_PRFDEFAULT = @ProgramFilesDir & '\Microsoft Office\'
;Full Path to PRFDEFAULT.PRF - No Changes Required, make changes above
;Checks to see if the PRFDEFAULT.PRF Exists, if not then copies it to the $DIR_PRFDEFAULT Directory otherwise skip
	FileCopy($FIL_PRFDEFAULT, @ProgramFilesDir & '\Microsoft Office\', 1)
;Checks to see if the PRFDEFAULT as specified in PRFDEFAULT.PRF "DefaultProfile" exists, if not tells Outlook to run the PRFDefault.PRF when it's started.
$REG_PRFDEFAULT = RegRead('HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\', 'DefaultProfile')
If $REG_PRFDEFAULT = 'PRFDefault' Then
	RegWrite('HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles', 'DefaultProfile', 'REG_SZ', '')
	RegDelete('HKCU\Software\Microsoft\Office\11.0\Outlook\Setup', 'First-Run')
	RegWrite('HKCU\Software\Microsoft\Office\11.0\Outlook\Setup', 'importPRF', 'REG_SZ', $FIL_PRFDEFAULT)
	RegWrite('HKCU\Software\Microsoft\Office\11.0\Outlook', 'UserData', 'REG_DWORD', '1')

Open in new window

Hey well im back again,

more problems:(

Using importprf doesnt get rid of the message? ]

any ideas why?


IF EXIST "C:\EmailConfig2\Test5.prf" GOTO : Next
cmd.exe /c md c:\EmailConfig2
XCOPY "\\eucs1\software\MS Office Pro 2003\Prfs\*.*" "C:\EmailConfig2"
START "\\eucs1\software\MS Office Pro 2003\OUTL11.msi" /importprf "C:\EmailConfig2\Test5.prf">>"%appdata%\Microsoft\OUTLOOK\OUTPRF.SET"

Open in new window


Not sure why your script is setup this way, try the batch below, also couple of notes:

:: The firstline should check if the PRF has been imported rather than checking if the PRF Exists, you could have both of course, as shown in my example below
:: You need to Start Outlook with the switch /importprf not the MSI File
::CMD isn't required since this is running from batch anyways
:: Recommend you create variables so that you only have to make changes to the variables rather the entire script.(optional but makes it easier in future changes)


SET OUTLKEXE=%PROGRAMFILES%\Microsoft Office\Office11\Outlook.exe
SET SERVRDIR=\\eucs1\software\MS Office Pro 2003\Prfs

Open in new window

Also, here's an easier way I found to configure the profile the first time a user opens Outlook. Hope it helps:
IF EXIST "%appdata%\Microsoft\OUTPRF.SET" GOTO :Next
SET KEY1="HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Setup"
REG ADD %KEY1% /V FirstRun /d -
REG ADD %KEY1% /V First-Run /d -
ECHO "Done!" >>"%appdata%\Microsoft\OUTPRF.SET"

Open in new window

That is true, although the problem I found is that if for instance the outlook profile becomes corrupted or is removed than this no longer works.  So it's a one off basically, I use this method myself when building our laptop/desktop images, I also configure a Outlook Desktop Icon with the Office Admin to import the prf, that way even if in the future the profile does come corrupt, staff only have to double click the Outlook icon on the Desktop and it will recreate the profile for them.


Use Outlook Profiler and be done with it. Not free but sure beats looking at cryptic PRF files. Your call.

Hello all,

I want to be able to add a secondary Exchange profile, I dont want to overwrite any exisiting file because users should be able to access their mail from a different Exchange server. Is there a way to automate this and create a secondary Profile?

Yes Outlook Profiler works great... but it doesnt have a switch to create a secondary profile.. only to overwrite.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial