VBScript to Automate Outlook Profile creation

  • Thread starter jeremiah.meyers
  • Start date
J

jeremiah.meyers

I made this script to Automate the Outlook Profile creation using a
PRF file on a shared Network Location. This script if used with
Active Directory can go into the path for the Logon script under the
Profile tab or appended to one of your existing logon scripts to be
called after or before the execution of other scripts. This script is
currently being used in an environment with Windows XP clients Windows
2000 Domain Controllers and a Windows 2003 Standard Edition Mail
server running Exchange 2003. This script is compatable with Outlook
97 all the way up to Outlook 2003.


Here is the Script:

'Script created 2/2/2007 by Jeremiah Meyers

Option Explicit
On Error Resume Next

' Dim Our Variables

Dim objShell, objOutlook
Dim sFRKey, sFRSearch, sOutlookVersion

' Create Outlook object and Shell object

set objOutlook = CreateObject("Outlook.Application")
set objShell = CreateObject("WScript.Shell")

' Determine Which version client is using before moving on

if objOutlook.Version >= "11.0" And objOutlook.version <= "11.1" Then
sOutlookVersion = "11.0"
End If

if objOutlook.Version >= "10.0" And objOutlook.version <= "10.1" Then
sOutlookVersion = "10.0"
End If

if objOutlook.Version >= "9.0" And objOutlook.version <= "9.1" Then
sOutlookVersion = "9.0"
End If

if objOutlook.Version >= "8.0" And objOutlook.version <= "8.1" Then
sOutlookVersion = "8.0"
End If

'Strings
sFRKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\" &
sOutlookVersion & "\Outlook\Setup\First-Run"
'Search for it
sFRSearch = objShell.RegRead(sFRKey)

' Does key exist?
If err <> 0 Then
'Wscript.Echo "PRF is being Imported"
objShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\" &
sOutlookVersion & "\Outlook\Setup\ImportPRF", "\\DCserver1\NETLOGON
\Outlook\Outlook.prf", "REG_SZ"
objShell.RegDelete "HKEY_CURRENT_USER\Software\Microsoft\Office\" &
sOutlookVersion & "\Outlook\Setup\First-Run"
objShell.RegDelete "HKEY_CURRENT_USER\Software\Microsoft\Office\" &
sOutlookVersion & "\Outlook\Setup\FirstRun"
Else
'Wscript.Echo "PRF exists"
End if

' Clean up
set objShell = Nothing
set objOutlook = Nothing

Hope this helps in solving any questions that concern creating an
Outlook Profile using a Logon Script.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top