Page 1 of 1 1
Topic Options
#7045 - 2001-02-21 09:07 PM Exchange question
Anonymous
Unregistered


Does anyone have an example of a script for putting in the name of an exchange server for the outlook profile based on a location.
We have 7 country locations and each loation has it own exchange server
any help would very much be appreciated

Thanks

Top
#7046 - 2001-02-21 09:20 PM Re: Exchange question
Paul_Berquam Offline
Hey THIS is FUN

Registered: 2000-08-02
Posts: 310
Loc: Sacramento, CA USA
Here is an example, I have a baseline PRF file already set up and this goes through it and updates the PRF file with the appropriate entries before running the NEWPROF util to create the profile.

code:

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


------------------

"He was a good little monkey and always very curious..."

_________________________
He was a good little monkey and always very curious...

Top
#7047 - 2001-02-22 11:55 PM Re: Exchange question
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Thank you paul...

...and the script keeps getting bigger...

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#7048 - 2001-02-27 09:13 AM Re: Exchange question
Anonymous
Unregistered


Thanks Paul
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.133 seconds in which 0.07 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org