Page 1 of 1 1
Topic Options
#76441 - 2003-08-19 08:10 PM Outlook Profile UDF
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I only have win2k and outlook 2k, what would be missing for other common environments:

code:
 
OutlookProfile('test','S:\ModProf',,'ExchangeMail',@userid)


function OutlookProfile($ProfileName, $ModProfDir, optional $default, Optional $ExchangeServer, optional $account, Optional $ldapServer)
dim $tempfile, $defaultprofile

$tempfile = '%temp%\modprof.prf'
$DefaultProfile = ReadValue('HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles', "DefaultProfile")
$default = iif($default and not $DefaultProfile = $ProfileName,'Yes','No')

if not keyexist('HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\'+$ProfileName)
copy '$ModProfDir\modprof.prf' $tempfile

$ = WRITEPROFILESTRING ($tempfile, 'General', "Custom", "1")
$ = WRITEPROFILESTRING ($tempfile, 'General', "ProfileName", $ProfileName)
$ = WRITEPROFILESTRING ($tempfile, 'General', "DefaultProfile", $default)
$ = WRITEPROFILESTRING ($tempfile, 'General', "OverwriteProfile", "Append")
$ = WRITEPROFILESTRING ($tempfile, 'General', "DefaultStore", "Service2")
$ = WRITEPROFILESTRING ($tempfile, 'General', "UniqueService", "Yes")
$ = WRITEPROFILESTRING ($tempfile, 'Service List', "Service1", "Microsoft Outlook Client")
$ = WRITEPROFILESTRING ($tempfile, 'Service List', "Service3", "Outlook Address Book")
$ = WRITEPROFILESTRING ($tempfile, 'Service3', "Ben", "True")
if $ExchangeServer and $account
$ = WRITEPROFILESTRING ($tempfile, 'Service List', "Service2", "Microsoft Exchange Server")
$ = WRITEPROFILESTRING ($tempfile, 'Service2', "HomeServer", $ExchangeServer)
$ = WRITEPROFILESTRING ($tempfile, 'Service2', "MailBoxName", $account)
endif
if $ldapServer
$ = WRITEPROFILESTRING ($tempfile, 'Service List', "Service4", "Microsoft LDAP Directory")
$ = WRITEPROFILESTRING ($tempfile, 'Service4', "LDAPServer", $ldapServer)
$ = WRITEPROFILESTRING ($tempfile, 'Service4', "SearchBase", right(join(split($ldapServer,'.'),',dc='),-1))
endif
SHELL 'cmd /c $ModProfDir\modprof.exe -P $tempfile -x'
sleep 1
DEL $tempfile
ENDIF
endfunction

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

Top
#76442 - 2003-08-19 08:15 PM Re: Outlook Profile UDF
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
rad, why you do write these values to the tempfile when you could do it manually once for all?

I did my outlook 97 & 2k stuff with 5 lines of code including all the checks.
and it looks to me that you could do that too.

[ 19. August 2003, 20:15: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#76443 - 2003-08-19 08:17 PM Re: Outlook Profile UDF
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
we have more than 1 mailserver.

some people have access to the ldap server.

some people have more than 1 profile.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#76444 - 2003-08-19 08:38 PM Re: Outlook Profile UDF
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja!
those lines I understand.
but what about those hardcoded ones?

I could quess doc would say that you have something else than exchange servers and like that.
but, then those shouldn't be hardcoded, right?

be cool, I'm just trying to piss you off a little [Wink]

...am I not? [Eek!]
_________________________
!

download KiXnet

Top
#76445 - 2003-08-19 08:40 PM Re: Outlook Profile UDF
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I see your point... and I'm looking at it again.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#76446 - 2003-08-21 12:52 AM Re: Outlook Profile UDF
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
rad, you did any work on this yet?
_________________________
!

download KiXnet

Top
#76447 - 2003-08-21 12:59 AM Re: Outlook Profile UDF
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, at least the default is little weird.

$default = iif($default and not $DefaultProfile = $ProfileName,'Yes','No')


now, if one has no profile installed yet, doesn't this skip the default?
so shouldn't it just be:

$default = iif($default,'Yes','No')
_________________________
!

download KiXnet

Top
#76448 - 2003-08-20 02:30 PM Re: Outlook Profile UDF
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Jooel,

You trying to get me to simplify the FAQ too - Outlook/Exchange Configuration? [Wink] Yes, I know it is overkill.

IIRC, we talked about using the ORK to do this as well. I think this this process is supported under a GPO as well.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#76449 - 2003-08-20 02:46 PM Re: Outlook Profile UDF
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
no, not the faq.
I know who wrote it and I know that trying to make the author change it, that would be overtry. [Big Grin]

but, looking at radimus' script, I think it indeed could be easened.

all the optional arguments could have the default behaviour in the file too, thus all writing on them would not be needed if not specified.
_________________________
!

download KiXnet

Top
#76450 - 2003-08-20 02:53 PM Re: Outlook Profile UDF
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
code:
 
function OutlookProfile($ProfileName, $ModProfDir, $ExchangeServer, $account, optional $default)
dim $tempfile, $defaultprofile

$WMSProfiles = 'HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
$tempfile = '%temp%\modprof.prf'
$DefaultProfile = ReadValue($WMSProfiles, "DefaultProfile")
$default = iif($default and not $DefaultProfile = $ProfileName,'Yes','No')
if not keyexist($WMSProfiles+'\'+$ProfileName)
copy '$ModProfDir\modprof.prf' $tempfile
$ = WRITEPROFILESTRING ($tempfile, 'General', "ProfileName",$ProfileName)
$ = WRITEPROFILESTRING ($tempfile, 'Service2',"HomeServer", $ExchangeServer)
$ = WRITEPROFILESTRING ($tempfile, 'Service2',"MailBoxName",$account)
SHELL 'cmd /c $ModProfDir\modprof.exe -P $tempfile -x'
if not @error $OutlookProfile=1 else exit @error endif
sleep 1
DEL $tempfile
ENDIF
if $default='Yes'
$=writeValue($WMSProfiles,'DefaultProfile',$ProfileName,REG_SZ)
endif
endfunction

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

Top
#76451 - 2003-08-20 03:10 PM Re: Outlook Profile UDF
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you still left the iif like it was.
well, I took the liberty to change your latest:

function OutlookProfile($ProfileName, $ModProfDir, $ExchangeServer, $account, optional $default)
dim $tempfile

$WMSProfiles = 'HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
$tempfile = '%temp%\modprof.prf'
if not keyexist($WMSProfiles+'\'+$ProfileName)
copy '$ModProfDir\modprof.prf' $tempfile
$ = WRITEPROFILESTRING ($tempfile, 'General', "ProfileName",$ProfileName)
$ = WRITEPROFILESTRING ($tempfile, 'Service2',"HomeServer", $ExchangeServer)
$ = WRITEPROFILESTRING ($tempfile, 'Service2',"MailBoxName",$account)
SHELL 'cmd /c $ModProfDir\modprof.exe -P $tempfile -x'
if @error
exit @error
endif
sleep 1
DEL $tempfile
endif
if $default
$ = writeValue($WMSProfiles,'DefaultProfile',$ProfileName,REG_SZ)
if @error
exit @error
endif
endif
endfunction



anyway, got another question...
what if there is profile with same name but with wrong values?
_________________________
!

download KiXnet

Top
#76452 - 2003-08-20 03:41 PM Re: Outlook Profile UDF
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
users are too stupid to create a profile on their own... and if so, they usually leave the profile name as default (MS Exchange Settings, Default Outlook Settings)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#76453 - 2003-08-20 03:46 PM Re: Outlook Profile UDF
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
good answer [Big Grin]
_________________________
!

download KiXnet

Top
Page 1 of 1 1


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

Who's Online
0 registered and 931 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.066 seconds in which 0.029 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