Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CONFIGURE OUTLOOK PROFILE VBSCRIPT 1

Status
Not open for further replies.

TheNewOne

Technical User
Mar 27, 2004
117
0
0
SI
Hi forum. Anybody here maybe knows, if is possible to configure outlook profile with VB logon script???? Every help is wellcome. Thx

Jure
 
What version of Outlook? I have a script that creates profiles on Outlook 2000 - 2003.
 
Thx for reply SIPIN. I use Outlook 2000.
 
Ha! My manager just asked that we add this to our script too. Could you forward the script to me as well.
 
You gus should download a copy of the ORK (Office Resource Kit. You can push down entirely configured versions of Outlook and your user will just get prompted for their initials on first load.

Please refer to my FAQ for details. faq96-4996

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Here is the code. Sorry it took so long, been a little busy lately. Just follow the instructions and download the required files in files.zip at use login sipin password 123456

-Sip

'==========================================================================
'
' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 3.1
'
' NAME:
'
' AUTHOR: Sip
' DATE : 8/1/2004
'
' COMMENT: Creates user's Outlook profile. The script creates a PRF directory on the user's home directory then copies %USERNAME%.prf within the PRF directory.
' Must have a source PRF directory and target user's home directory. Create a directory named "PRF" and put it on a share, copy the two .prf files and newprof.exe to this directory.
' Open the .prf files in Notepad and edit New.prf "[ServiceEGS]&[Service1] HomeServer=NAMEOFMAILSERVER" Old.prf "[Service2] HomeServer=NAMEOFMAILSERVER.
' If you have Outlook 2000 clients, copy cpau.exe and Outlook2000Reg.vbs to a share on your server. This will be needed to add registry entries.
' The user's .prf file will be used to create their initial profile and to hold their Outlook settings. With outlook.exe you can export settings to the .prf then import into Outlook.
' Tested on Windows 2000 and XP machines running Outlook 2000 - 2003.
'==========================================================================
'On Error Resume Next
'Initialize variables
Set oNet = WScript.CreateObject("WScript.Network")
Set WSHFileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set WSHShell = WScript.CreateObject("WScript.Shell")
strUserDomain = oNet.UserDomain
strUserName = oNet.UserName
HomeDrive = "U:\" ' Specify the user's home directory drive.
PRFpath = "\\SERVER\Share01\PRF" ' Specify the path to the .prf template.
UserHome = "\\SERVER\Users\" & strUserName ' Specify the user's home directory.
UserPRF = UserHome & "\PRF\" ' Specify the path where the user's .prf will reside.
NewPRF = "New.prf" ' Name of the Outlook 2003/XP .prf template.
OldPRF = "Old.prf" ' Name of the Outlook 2000 template.
Path = UserPRF & strUserName & ".prf" ' Changes copied .prf file to user's %USERNAME%.
WSHInstall = "\\SERVER\Installs" ' Specify name of directory that holds objects.

AddReg ' Adds registry entries for Outlook 2000.
OutlookProfile ' Creates PRF\%USERNAME% on the user's home directory. Creates Outlook profile.

Sub OutlookProfile()
On Error Resume Next
If Outlookver = "Outlook 2003" Then
arr = WSHShell.RegRead("HKCU\Software\Microsoft\Office\11.0\Outlook\Setup\First-Run")
If arr = True Then
ElseIf Err.Number <> 0 Then
WSHShell.RegWrite "HKCU\Software\Microsoft\Office\11.0\Outlook\Setup\"
If (WSHFileSystem.FileExists(PRFpath & "\" & NewPRF)) Then
WSHFileSystem.CreateFolder(UserHome & "\PRF")
WSHFileSystem.CopyFile PRFpath & "\" & NewPRF, Path
'WScript.Echo "Downloading Outlook Profile.."
WSHShell.RegWrite "HKCU\Software\Microsoft\Office\11.0\Outlook\Setup\" & "ImportPRF", Path , "REG_SZ"
'WScript.Echo "Setting Outlook Profile.."
End If
End If
'End If
Else
If Outlookver = "Outlook XP" Then
arr = WSHShell.RegRead("HKCU\Software\Microsoft\Office\10.0\Outlook\Setup\First-Run")
If arr = True Then
ElseIf Err.Number <> 0 Then
WSHShell.RegWrite "HKCU\Software\Microsoft\Office\10.0\Outlook\Setup\"
If (WSHFileSystem.FileExists(PRFpath & "\" & NewPRF)) Then
WSHFileSystem.CreateFolder(UserHome & "\PRF")
WSHFileSystem.CopyFile PRFpath & "\" & NewPRF, Path
'WScript.Echo "Downloading Outlook Profile.."
WSHShell.RegWrite "HKCU\Software\Microsoft\Office\10.0\Outlook\Setup\" & "ImportPRF", Path , "REG_SZ"
'WScript.Echo "Setting Outlook Profile.."
End If
End If
'End If
Else
If Outlookver = "Outlook 2000" Then
arr = WSHShell.RegRead("HKCU\Software\Microsoft\Office\9.0\Outlook\Setup\First-Run")
If arr = True Then
ElseIf Err.Number <> 0 Then
If (WSHFileSystem.FileExists(PRFpath & "\" & OldPRF)) Then
WSHFileSystem.CreateFolder(UserHome & "\PRF")
WSHFileSystem.CopyFile PRFpath & "\" & OldPRF, Path
'WScript.Echo "Downloading Outlook Profile.."
WSHShell.Run PRFpath & "\NEWPROF.exe -p " & Path,1,True
'WScript.Echo "Setting Outlook Profile.."
End If
End If
' Else
' If Err.Number = 0 Then
' WScript.Echo "Profile already exists."
End If
End If
End If
End Sub

Function Outlookver()
If DetermineObject <> "" Then
Dim X
Set X = CreateObject(DetermineObject)
If Len(X.version) = 11 Then
Select Case Left(X.version,2)
Case "11"
Outlookver = "Outlook 2003"
Case "10"
Outlookver = "Outlook XP"
End Select
ElseIf Len(X.version) = 10 Then
Select Case Left(X.version,1)
Case "9"
Outlookver = "Outlook 2000"
End Select
Set X = Nothing
Else OutlookVer = "Unknown"
' End If
' End If
End If
End If
End Function

Function DetermineObject()
On Error Resume Next
Dim NEW_OBJ: Set NEW_OBJ = CreateObject("Outlook.Application.11")
Dim OLD_OBJ: Set OLD_OBJ = CreateObject("Outlook.Application")
Dim OLDER_OBJ: Set OLDER_OBJ = CreateObject("Outlook.Application.9")
If IsObject(NEW_OBJ) Then
DetermineObject = "Outlook.Application.11"
ElseIf IsObject(OLD_OBJ) Then
DetermineObject = "Outlook.Application"
ElseIf IsObject(OLDER_OBJ) Then
DetermineObject = "Outlook.Application.9"
Else
DetermineObject = ""
End If
End Function
 
Nice script SIPIN :)

However, it crashes on line 33: AddReg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top