;************************************************************
;** Script: NewOLProf
;** Created: 07/25/2000
;** Updated: 07/26/2000
;**
;** Author: Paul Berquam
;** E-mail: paul_berquam@bigfoot.com
;**
;** Function:
;** Create default outlook profile and install if missing
;**
;** Assumptions:
;** 1. Directory of \kix\OL exists in netlogon share
;** 2. the files newprof.exe and outlook.prf exist in this directory
;** 3. No Default Messaging profiles exist for current login profile
;**
;** Based on script provided by David Miller - dmiller@apcoassoc.com
;************************************************************
;** 8/9/00 - PB Updated and changed temp directory to c:\temp$ExFileLoc = "c:\temp" ;Location where custom profile file is to be copied to
$copysource = "@scriptdir\kix\ol\outlook.prf" ;Location of baseline profile file
$File = $ExFileLoc + "\OUTLOOK.PRF" ;Custom profile filename
if exist ("ExfileLoc") = 0
md "ExfileLoc"
endif
$exserver = "Defaultservername"
;TCPIP Check
$TCPIP = @IPAddress0
$1octet = val(substr($TCPIP,1,3))
$2octet = val(substr($TCPIP,5,3))
$3octet = val(substr($TCPIP,9,3))
$4octet = val(substr($TCPIP,13,3))
Select
case $1octet = 192 and $2octet = 168
select
case $3octet = 150
$exserver = "server1"
case $3octet = 151
$exserver = "server2"
case 1
$exserver = "Default"
endselect
case $1octet = 192 and $2octet = 169
select
case $3octet = 10
$exserver = "server3"
case $3octet = 12
$exserver = "server4"
case 1
$exserver = "Default"
endselect
case 1
$exserver = "Default"
;or you can provide some sort of error message, etc
endselect
IF @INWIN = 1
$MsgKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
ELSE
$MsgKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows Messaging Subsystem\Profiles"
ENDIF
$MProfile = ReadValue($MsgKey, "DefaultProfile") ;Read the current default profile
? "Profile is: <$Mprofile>" ? ;debug message ;Echos existing profile name
; ;
;DEL "C:\Program Files\Microsoft Office\Office\*.msg" ;Stubbed - Microsoft Default message
IF $MProfile = "" ;If there is not default profile, create the profile using the PRF
GOSUB CreatePRF ;Creates temp profile file
? "Creating Profile...."
$CMDLine = @Lserver + "\netlogon\kix\ol\newprof.exe -P " + $File + " -s -x -z"
SHELL $CMDLine ;Creates the Messaging profile
DEL "$File" ;Delete temp file
ENDIF
:End
EXIT
;-------------------------------------------------------
:CreatePRF
DEL "$File" ;Deletes any existing PRF file
COPY "$copysource" "$exfileloc" ;Copies baseline PRF file to temp directory
? "Creating Mail Profile temp file..."
$section = "General" ? "Writing $section"
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "Custom", "1")
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "ProfileName", "@UserID")
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "DefaultProfile", "Yes")
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "OverwriteProfile", "No")
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "DefaultStore", "Service2")
$section = "Service List" ? "Writing $section"
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "Service1", "Microsoft Outlook Client")
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "Service2", "Microsoft Exchange Server")
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "Service3", "Outlook Address Book")
$section = "Service2" ? "Writing $section"
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "HomeServer", "$exserver")
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "MailBoxName", "@userid")
$section = "Service3" ? "Writing $section"
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "Ben", "True")
$section = "Service4" ? "Writing $section"
$PRFFile = WRITEPROFILESTRING ($FILE, $section, "Ben", "True")
return