Solved

Automatically create Outlook user profiles on login

Posted on 2006-10-19
21
30,780 Views
Last Modified: 2011-08-18
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.
0
Comment
Question by:ksilvoso
  • 8
  • 5
  • 4
  • +4
21 Comments
 
LVL 29

Expert Comment

by:matrixnz
ID: 17770144
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)
http://download.microsoft.com/download/0/e/d/0eda9ae6-f5c9-44be-98c7-ccc3016a296a/ork.exe

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
; **************************************************************

[General]
BackupProfile=No
Custom=1
ProfileName=%Username%
DefaultProfile=Yes
OverwriteProfile=Yes
ModifyDefaultProfileIfPresent=FALSE
0
 
LVL 1

Author Comment

by:ksilvoso
ID: 17774030
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.
0
 
LVL 29

Expert Comment

by:matrixnz
ID: 17775566
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\domain.com
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

Cheers
0
 
LVL 1

Author Comment

by:ksilvoso
ID: 17776160
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
0
 
LVL 29

Expert Comment

by:matrixnz
ID: 17778385
Hmmm

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 http://office.microsoft.com/en-us/assistance/HA011402581033.aspx


 
0
 
LVL 1

Author Comment

by:ksilvoso
ID: 17791008
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...
0
 
LVL 29

Accepted Solution

by:
matrixnz earned 125 total points
ID: 17795057
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"

:Next

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"

:Next

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:

[HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Setup]
"FirstRun"=-
"First-Run"=-
"ImportPRF"="\\\\SERVER\\SHARE\\OUTLOOK.PRF"

Then use the following within the logon script:

IF EXIST "%appdata%\Microsoft\OUTLOOK\OUTPRF.SET" GOTO :Next
REGEDIT /s "\\SERVER\SHARE\OUTLOOK.reg">>"%appdata%\Microsoft\OUTLOOK\OUTPRF.SET"

:Next

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

Cheers
0
 
LVL 1

Author Comment

by:ksilvoso
ID: 17821150
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.
0
 

Expert Comment

by:emurtagh
ID: 20831725
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
0
 

Expert Comment

by:ali678
ID: 21282289
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

C:\%windir%\..........

...see i'd like to have it run only if the users have not got their mail on that pc before
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 29

Expert Comment

by:matrixnz
ID: 21285640
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.
example:

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"

:Next

Cheers
0
 

Expert Comment

by:ali678
ID: 21292410
Thanks thats brill:)

 i'll try that in work tomorrow :)
0
 

Expert Comment

by:ali678
ID: 21298453
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"
:Next

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:)
0
 

Expert Comment

by:ali678
ID: 21301249
sorry i didnt read above
0
 
LVL 29

Expert Comment

by:matrixnz
ID: 21301542
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.

[General]
BackupProfile=No
Custom=1
ProfileName=PRFDefault
DefaultProfile=Yes
OverwriteProfile=Yes
ModifyDefaultProfileIfPresent=TRUE

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 http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe
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 http://www.autoitscript.com/autoit3/scite/downloads.shtml

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.

Cheers

#NoTrayIcon
 

;Default PRF File Name - Change if your PRF is named different

$PRF_PRFDEFAULT = 'PRFDEFAULT.PRF'

;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

$FIL_PRFDEFAULT = $DIR_PRFDEFAULT & $PRF_PRFDEFAULT
 

;Checks to see if the PRFDEFAULT.PRF Exists, if not then copies it to the $DIR_PRFDEFAULT Directory otherwise skip

$CHK_PRFDEFAULT = FileExists($FIL_PRFDEFAULT)

If Not $CHK_PRFDEFAULT Then

	FileCopy($FIL_PRFDEFAULT, @ProgramFilesDir & '\Microsoft Office\', 1)

EndIf
 

;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

	Exit

Else

	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')

EndIf

Open in new window

0
 

Expert Comment

by:ali678
ID: 21303338
Hey well im back again,

more problems:(

Using importprf doesnt get rid of the message? ]

any ideas why?

cheers





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"
 

:Next

Open in new window

0
 
LVL 29

Expert Comment

by:matrixnz
ID: 21305633
Ummm

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)

Cheers

SET OUTLKEXE=%PROGRAMFILES%\Microsoft Office\Office11\Outlook.exe

SET OUTLKSET=%APPDATA%\Microsoft\OUTLOOK\OUTPRF.SET

SET OUTLKPRF=Test5.prf

SET OUTLKDIR=%SYSTEMDRIVE%\EmailConfig2

SET SERVRDIR=\\eucs1\software\MS Office Pro 2003\Prfs
 

IF EXIST "%OUTLKDIR%\%OUTLKPRF%" GOTO SETPROFILE

MD "%OUTLKDIR%\"

COPY "%SERVRDIR%\%OUTLKPRF%" "%OUTLKDIR%\" /Y
 

:SETPROFILE

IF EXIST "%APPDATA%\Microsoft\OUTLOOK\OUTPRF.SET" GOTO NEXT

START "%OUTLKEXE%" /importprf "%OUTLKDIR%\%OUTLKPRF%">"%OUTLKSET%"
 

:Next

Open in new window

0
 
LVL 2

Expert Comment

by:emdewey
ID: 24605494
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 -

REG ADD %KEY1% /V ImportPRF /d \\SERVER\SHARE\OUTLOOK.PRF

ECHO "Done!" >>"%appdata%\Microsoft\OUTPRF.SET"
 

:Next

Open in new window

0
 
LVL 29

Expert Comment

by:matrixnz
ID: 24606626
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.

Cheers
0
 
LVL 6

Expert Comment

by:pcunite
ID: 24984782
Use Outlook Profiler and be done with it. Not free but sure beats looking at cryptic PRF files. Your call.
0
 

Expert Comment

by:m_rawson
ID: 26498202
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.

0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Find out how to use dynamic social media in email signatures with this top 10 DOs & DON’Ts.
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

707 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

15 Experts available now in Live!

Get 1:1 Help Now