Real Life Deployment of Outlook using PRF files

The Outlook profile file (PRF file) allows you to create MAPI profiles for Outlook users. The PRF file is a text file with syntax that Outlook uses to generate a profile. Using a PRF file, you can create new profiles for users or modify existing profiles.

I had an assignment which required me to write a script that calls a PRF file. The PRF file creates a new Outlook profile for each of the users.  The script will run in the logon services so it needs some basic logic to ensure that it is executed only once.

Here are a couple of samples that we have got ( they may need modification to suit your enviornment)




SCRIPT SAMPLE 1

Const ForReading = 1, ForWriting = 2, ForAppending = 8, CreateNew = True
Const OverwriteExisting = TRUE

Set objShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")

Profile = objShell.ExpandEnvironmentStrings("%userprofile%")

If NOT (objFSO.FileExists(Profile & "\ProfileModified.log")) Then

ObjShell.Run ("outlook.exe /importprf \\srbhfl01\logon\outlook.prf")

Set objFile = objFSO.CreateTextFile(Profile & "\ProfileModified.log", ForWriting)
objFile.Write "Created a new Outlook profile on " & Date & " at " & Time
objFile.close

End If

SCRIPT SAMPLE 2

"If not exist "%USERPROFILE%\profdone.txt" ( start outlook.exe /importprf "\\server\share\profile.PRF" copy "\\server\share\profdone.txt" "%USERPROFILE%")"

Explaination:

1. These scripts will check for profdone.txt file in the user profile every time it runs. ( the profdone.txt is a simple txt file created on a network share)
2. If the profdone.txt is not available then it will run the “outlook.exe /importprf \\server\share\profile.PRF” command to import the PRF file
3. Once the Importprof is run it will copy the profdone.txt to the userprofile so that the script does not run again.

 

What did you think of this article?




Trackbacks
  • Trackbacks are closed for this post.
Comments
  • No comments exist for this post.
Leave a comment

Submitted comments are subject to moderation before being displayed.

 Name (required)

 Email (will not be published) (required)

Your comment is 0 characters limited to 3000 characters.