Page 1 of 1 1
Topic Options
#112263 - 2004-01-22 05:07 PM Outlook/Exchange script help?
cwhitmore Offline
Starting to like KiXtart

Registered: 2001-05-23
Posts: 102
Loc: Austin, Texas, USA
I used the Outlook script provided in the HOWTO forum, but I'm having trouble getting it to work. It creates a profile for the user, but the profile is blank. Here is code I have at the top of Outlook.kix: (I'm using Office XP Pro)

;Some initial settings
$profile_remove='Yes' ; Remove All other Outlook profiles under current user
$deleteitems='No'; Empty Outlooks Deleted Items Folder on Exit
$explorview='Yes' ; Outlook Explorer View 'Yes' or Standard View 'No'
$editorpref='30001' ; Editor Preference 10001=Plain Text, 20001=HTML, and 30001=Rich Text
$prf='FromSrv.prf'
$company='Advocacy, Inc.'
$serverloc='\\server1\Netlogon\Functions' ; Outlook Executables/files location
$exchangeserver='EXCHANGE' ; Main Exchange Server Location

I have Outlook.kix in \Functions along with Profgen.exe, NewProf.exe and FromSrv.prf

I'm calling the script from my testlogin.bat batch file:

Call '\\server1\NETLOGON\functions\Outlook.kix'
MessageBox ("Finished process", "Scripts",1,3)
Exit

What am I missing?
Carlton.

Top
#112264 - 2004-01-22 05:09 PM Re: Outlook/Exchange script help?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Please read ABC's of KiXtart board etiquette and message to new forum users and refrain from double/cross-posting.
_________________________
There are two types of vessels, submarines and targets.

Top
#112265 - 2004-01-22 05:43 PM Re: Outlook/Exchange script help?
cwhitmore Offline
Starting to like KiXtart

Registered: 2001-05-23
Posts: 102
Loc: Austin, Texas, USA
Oops, wasn't sure which forum this post should go in so I posted in both. Can someone help me with this script?
Carlton.

Top
#112266 - 2004-01-22 06:49 PM Re: Outlook/Exchange script help?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
this is not so much related to the script you run but more to the way our faq suggests running profile generation...
there is in ORK toolbox new tool called modprof.exe
kent or someone who can answer, why we ain't using that?
_________________________
!

download KiXnet

Top
#112267 - 2004-01-23 06:02 AM Re: Outlook/Exchange script help?
Kdyer Offline
KiX Supporter
*****

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

Here is a bit of a "silver platter"..



You should not need PROFGEN.EXE, MODPROF.EXE, NEWPROF.EXE etc. But, you still need the PRF file.

Code:

;Some initial settings
$profile_remove='Yes' ; Remove All other Outlook profiles under current user
$deleteitems='Yes'; Empty Outlooks Deleted Items Folder on Exit
$explorview='Yes' ; Outlook Explorer View 'Yes' or Standard View 'No'
$editorpref='30001' ; Editor Preference 10001=Plain Text, 20001=HTML, and 30001=Rich Text
$prf='FromSrv.prf'
$company='Advocacy, Inc.'
$serverloc=@lserver+'\Netlogon\Profgen\Outlook2000' ; Outlook files location
$exchangeserver='EXCHANGE' ; Main Exchange Server Location
;Registry locations
$ushelfolders='HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
$userwinkey='HKCU\Software\Microsoft\Windows'
$machinewinkey='HKLM\Software\Microsoft\Windows'
$mofckey='HKLM\Software\Microsoft\Office\'
$uofckey='HKCU\Software\Microsoft\Office\'

IF @inwin=1
;Windows NT/2k/XP/2003
$profilelocation=$userwinkey+' NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
$scriptdir=SUBSTR(READVALUE($ushelfolders,'Desktop'),1,LEN(READVALUE($ushelfolders,'Desktop'))-8)
ELSE
;Windows 9x
$profilelocation=$userwinkey+' Messaging Subsystem\Profiles'
;Need to insure that each user has their own desktop via the password applet in the Co ntrol Panel
$scriptdir=READVALUE('HKLM\Software\Microsoft\Windows\CurrentVersion\ProfileList\'+@USERID,'ProfileImagePath')
ENDIF

$prffile=$scriptdir+'\'+$prf
$ppru=$profilelocation+'\'+@userid
$mses=$profilelocation+'\MS Exchange Settings'
$exe=ReadValue($machinewinkey+'\CurrentVersion\App Paths\OUTLOOK.EXE','')
$ver=GetFileVersion($exe)
$verchk=SPLIT($ver,'.')[0]

MSUSERINFO
IF KeyExist($ppru) OR KeyExist($mses)
RETURN
ELSE
IF 0=Exist($scriptdir)
MD $scriptdir
ENDIF
COPY $serverloc+'\'+$prf $profiledir+'\'+$prf

PRFSETTINGS

IF $profile_remove='YES'
$index=0
$keyname=EnumKey($profilelocation,$index)
WHILE @error=0
IF $keyname<>@userid $rc=DelTree($profilelocation+'\'+$keyname)
ENDIF
$index=$index+1
$keyname=EnumKey($profilelocation,$index)
LOOP
ENDIF

OUTLOOK10AND11('10.0')

FUNCTION PRFSETTINGS()
; Custom Profile Settings
IF @userid<>ReadProfileString($prffile,'General','ProfileName')
$rc=WriteProfileString($prffile,'General','ProfileName',@userid)
ENDIF
IF 'Yes'<>ReadProfileString($prffile,'General','DefaultProfile')
$rc=WriteProfileString($prffile,'General','DefaultProfile','Yes')
ENDIF
IF $exchangeserver<>ReadProfileString($prffile,'Service2','HomeServer')
$rc=WriteProfileString($prffile,'Service2','HomeServer',$exchangeserver)
ENDIF
IF @userid<>ReadProfileString($prffile,'Service2','MailboxName')
$rc=WriteProfileString($prffile,'Service2','MailboxName',@userid)
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','AutoNameCheck')
$rc=WriteProfileString($prffile,'Service1','AutoNameCheck','TRUE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','ConfirmOnDelete')
$rc=WriteProfileString($prffile,'Service1','ConfirmOnDelete','FALSE')
ENDIF
IF $deleteitems='YES'
IF 'TRUE'<>ReadProfileString($prffile,'Service1','EmptyWastebasket')
$rc=WriteProfileString($prffile,'Service1','EmptyWastebasket','TRUE')
ENDIF
ELSE
IF 'FALSE'<>ReadProfileString($prffile,'Service1','EmptyWastebasket')
$rc=WriteProfileString($prffile,'Service1','EmptyWastebasket','FALSE')
ENDIF
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','RemoveSchdPlus')
$rc=WriteProfileString($prffile,'Service1','RemoveSchdPlus','FALSE')
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','SelectEntireWord')
$rc=WriteProfileString($prffile,'Service1','SelectEntireWord','TRUE')
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','CloseOriginalMessage')
$rc=WriteProfileString($prffile,'Service1','CloseOriginalMessage','TRUE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','GenReadReceipt')
$rc=WriteProfileString($prffile,'Service1','GenReadReceipt','FALSE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','GenDeliveryReceipt')
$rc=WriteProfileString($prffile,'Service1','GenDeliveryReceipt','FALSE')
ENDIF
IF 'True'<>ReadProfileString($prffile,'Service1','SaveSentMail')
$rc=WriteProfileString($prffile,'Service1','SaveSentMail','True')
ENDIF
IF 'No'<>ReadProfileString($prffile,'General','BackupProfile')
$rc=WriteProfileString($prffile,'General','BackupProfile','No')
ENDIF
ENDFUNCTION

FUNCTION OUTLOOK10AND11($vers)
$rc=DelValue($uofckey+$vers+'\Outlook\Setup','First-Run')
$rc=WriteValue($uofckey+$vers+'\Outlook\Setup','ImportPRF',$prffile,'REG_SZ')
SLEEP 1
;If '196610'<>ReadValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference')
; $rc=WriteValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference','196610','REG_DWORD')
;EndIf
;$pltextfont='3c0000000f0000e800000040c80000000600000000000000002056657264616e6100020000000000000000'
;$pltextfont=$pltextfont+'0000000000201a493a38e9070001000000'
;$rc=WriteValue($uofckey+$vers+'\Outlook\Preferences','TextFontSimple',$pltextfont,'REG_BINARY')
IF $explorview='Yes' AND $vers='10.0' ;Don't change version 11
$expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff2c0000002c00000084'
$expview=$expview+'020000dc01000001000000000000000100000000000000c0000000640000001800000003000000'
$rc=WriteValue($uofckey+$vers+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY')
ENDIF
ENDFUNCTION

FUNCTION MSUSERINFO()
IF KeyExist('HKCU\Software\Microsoft\Office')

; Process Company Name
$x=1
$regexp=''
WHILE $x<(Len($company)+1)
$regexp=$regexp+DecToHex(Asc(SubStr($company,$x,1)))+'00'
$x=$x+1
LOOP
$regexp=$regexp+'0000'
$companybin=$regexp

; Process FullName
$x=1
$regexp=''
WHILE $x<(Len(@fullname)+1)
$regexp=$regexp+DecToHex(Asc(SubStr(@fullname,$x,1)))+'00'
$x=$x+1
LOOP
$regexp=$regexp+'0000'
$fullnamebin=$regexp
; Process UserID
$useridbin=SubStr(@wuserid,1,2)
$x=1
$regexp=''
WHILE $x<(Len($useridbin)+1)
$regexp=$regexp+DecToHex(Asc(SubStr($useridbin,$x,1)))+'00'
$x=$x+1
LOOP
$regexp=$regexp+'0000'
$initials=$regexp

IF 0=KeyExist($uofckey+$ver+'\Common\UserInfo')
$rc=AddKey($uofckey+$ver+'\Common\UserInfo')
ENDIF
$regkey=$uofckey+$ver+'\Common\UserInfo'
IF KeyExist($regkey)
$rc=WriteValue($regkey,'Company',$companybin,'REG_BINARY')
$rc=WriteValue($regkey,'UserName',$fullnamebin,'REG_BINARY')
$rc=WriteValue($regkey,'UserInitials',$initials,'REG_BINARY')
ENDIF
ENDIF
ENDFUNCTION


HTH,

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

Top
#112268 - 2004-01-23 08:43 AM Re: Outlook/Exchange script help?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Kent,

You say you don't need PROFGEN yet you have this line in the code.

$serverloc=@lserver+'\Netlogon\Profgen\Outlook2000' ; Outlook Executables/files location


Top
#112269 - 2004-01-23 02:13 PM Re: Outlook/Exchange script help?
Kdyer Offline
KiX Supporter
*****

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

Thanks for the clarification..

I changed it to -

$serverloc=@lserver+'\Netlogon\Profgen\Outlook2000' ; Outlook files location

You still need the PRF file under Outlook XP/2003.

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

Top
#112270 - 2004-01-23 02:36 PM Re: Outlook/Exchange script help?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Here is the final code to address Outlook XP/2003.

;Some initial settings 
$profile_remove='Yes' ; Remove All other Outlook profiles under current user
$deleteitems='Yes'; Empty Outlooks Deleted Items Folder on Exit
$explorview='Yes' ; Outlook Explorer View 'Yes' or Standard View 'No'
$editorpref='30001' ; Editor Preference 10001=Plain Text, 20001=HTML, and 30001=Rich Text
$prf='FromSrv.prf'
$company='Advocacy, Inc.'
$serverloc=@lserver+'\Netlogon\Profgen\Outlook2000' ; Outlook files location
$exchangeserver='EXCHANGE' ; Main Exchange Server Location
;Registry locations
$ushelfolders='HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
$userwinkey='HKCU\Software\Microsoft\Windows'
$machinewinkey='HKLM\Software\Microsoft\Windows'
$mofckey='HKLM\Software\Microsoft\Office\'
$uofckey='HKCU\Software\Microsoft\Office\'

IF @inwin=1
;Windows NT/2k/XP/2003
$profilelocation=$userwinkey+' NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
$scriptdir=SUBSTR(READVALUE($ushelfolders,'Desktop'),1,LEN(READVALUE($ushelfolders,'Desktop'))-8)
ELSE
;Windows 9x
$profilelocation=$userwinkey+' Messaging Subsystem\Profiles'
;Need to insure that each user has their own desktop via the password applet in the Co ntrol Panel
$scriptdir=READVALUE('HKLM\Software\Microsoft\Windows\CurrentVersion\ProfileList\'+@USERID,'ProfileImagePath')
ENDIF

$prffile=$scriptdir+'\'+$prf
$ppru=$profilelocation+'\'+@userid
$mses=$profilelocation+'\MS Exchange Settings'
$exe=ReadValue($machinewinkey+'\CurrentVersion\App Paths\OUTLOOK.EXE','')
$ver=GetFileVersion($exe)
$verchk=SPLIT($ver,'.')[0]

MSUSERINFO
IF KeyExist($ppru) OR KeyExist($mses)
RETURN
ELSE
IF 0=Exist($scriptdir)
MD $scriptdir
ENDIF
COPY $serverloc+'\'+$prf $profiledir+'\'+$prf

PRFSETTINGS

IF $profile_remove='YES'
$index=0
$keyname=EnumKey($profilelocation,$index)
WHILE @error=0
IF $keyname<>@userid $rc=DelTree($profilelocation+'\'+$keyname)
ENDIF
$index=$index+1
$keyname=EnumKey($profilelocation,$index)
LOOP
ENDIF

OUTLOOK10AND11('10.0')

FUNCTION PRFSETTINGS()
; Custom Profile Settings
IF @userid<>ReadProfileString($prffile,'General','ProfileName')
$rc=WriteProfileString($prffile,'General','ProfileName',@userid)
ENDIF
IF 'Yes'<>ReadProfileString($prffile,'General','DefaultProfile')
$rc=WriteProfileString($prffile,'General','DefaultProfile','Yes')
ENDIF
IF $exchangeserver<>ReadProfileString($prffile,'Service2','HomeServer')
$rc=WriteProfileString($prffile,'Service2','HomeServer',$exchangeserver)
ENDIF
IF @userid<>ReadProfileString($prffile,'Service2','MailboxName')
$rc=WriteProfileString($prffile,'Service2','MailboxName',@userid)
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','AutoNameCheck')
$rc=WriteProfileString($prffile,'Service1','AutoNameCheck','TRUE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','ConfirmOnDelete')
$rc=WriteProfileString($prffile,'Service1','ConfirmOnDelete','FALSE')
ENDIF
IF $deleteitems='YES'
IF 'TRUE'<>ReadProfileString($prffile,'Service1','EmptyWastebasket')
$rc=WriteProfileString($prffile,'Service1','EmptyWastebasket','TRUE')
ENDIF
ELSE
IF 'FALSE'<>ReadProfileString($prffile,'Service1','EmptyWastebasket')
$rc=WriteProfileString($prffile,'Service1','EmptyWastebasket','FALSE')
ENDIF
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','RemoveSchdPlus')
$rc=WriteProfileString($prffile,'Service1','RemoveSchdPlus','FALSE')
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','SelectEntireWord')
$rc=WriteProfileString($prffile,'Service1','SelectEntireWord','TRUE')
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','CloseOriginalMessage')
$rc=WriteProfileString($prffile,'Service1','CloseOriginalMessage','TRUE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','GenReadReceipt')
$rc=WriteProfileString($prffile,'Service1','GenReadReceipt','FALSE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','GenDeliveryReceipt')
$rc=WriteProfileString($prffile,'Service1','GenDeliveryReceipt','FALSE')
ENDIF
IF 'True'<>ReadProfileString($prffile,'Service1','SaveSentMail')
$rc=WriteProfileString($prffile,'Service1','SaveSentMail','True')
ENDIF
IF 'No'<>ReadProfileString($prffile,'General','BackupProfile')
$rc=WriteProfileString($prffile,'General','BackupProfile','No')
ENDIF
ENDFUNCTION

FUNCTION OUTLOOK10AND11($vers)
$rc=DelValue($uofckey+$vers+'\Outlook\Setup','First-Run')
$rc=WriteValue($uofckey+$vers+'\Outlook\Setup','ImportPRF',$prffile,'REG_SZ')
SLEEP 1
;If '196610'<>ReadValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference')
; $rc=WriteValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference','196610','REG_DWORD')
;EndIf
;$pltextfont='3c0000000f0000e800000040c80000000600000000000000002056657264616e6100020000000000000000'
;$pltextfont=$pltextfont+'0000000000201a493a38e9070001000000'
;$rc=WriteValue($uofckey+$vers+'\Outlook\Preferences','TextFontSimple',$pltextfont,'REG_BINARY')
IF $explorview='Yes' AND $vers='10.0' ;Don't change version 11
$expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff2c0000002c00000084'
$expview=$expview+'020000dc01000001000000000000000100000000000000c0000000640000001800000003000000'
$rc=WriteValue($uofckey+$vers+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY')
ENDIF
ENDFUNCTION

FUNCTION MSUSERINFO()
IF KeyExist('HKCU\Software\Microsoft\Office')

; Process Company Name
$x=1
$regexp=''
WHILE $x<(Len($company)+1)
$regexp=$regexp+DecToHex(Asc(SubStr($company,$x,1)))+'00'
$x=$x+1
LOOP
$regexp=$regexp+'0000'
$companybin=$regexp

; Process FullName
$x=1
$regexp=''
WHILE $x<(Len(@fullname)+1)
$regexp=$regexp+DecToHex(Asc(SubStr(@fullname,$x,1)))+'00'
$x=$x+1
LOOP
$regexp=$regexp+'0000'
$fullnamebin=$regexp
; Process UserID
$useridbin=SubStr(@wuserid,1,2)
$x=1
$regexp=''
WHILE $x<(Len($useridbin)+1)
$regexp=$regexp+DecToHex(Asc(SubStr($useridbin,$x,1)))+'00'
$x=$x+1
LOOP
$regexp=$regexp+'0000'
$initials=$regexp

IF 0=KeyExist($uofckey+$ver+'\Common\UserInfo')
$rc=AddKey($uofckey+$ver+'\Common\UserInfo')
ENDIF
$regkey=$uofckey+$ver+'\Common\UserInfo'
IF KeyExist($regkey)
$rc=WriteValue($regkey,'Company',$companybin,'REG_BINARY')
$rc=WriteValue($regkey,'UserName',$fullnamebin,'REG_BINARY')
$rc=WriteValue($regkey,'UserInitials',$initials,'REG_BINARY')
ENDIF
ENDIF
ENDFUNCTION


HTH,

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

Top
#112271 - 2004-01-23 04:42 PM Re: Outlook/Exchange script help?
cwhitmore Offline
Starting to like KiXtart

Registered: 2001-05-23
Posts: 102
Loc: Austin, Texas, USA
Thanks for the updated script. I'm out of the office today, but I'll try it on Monday.
Cheers,
Carlton.

Top
#112272 - 2004-01-23 04:58 PM Re: Outlook/Exchange script help?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Please do notice it only includes just Outlook XP/2003. If you need an 'all inclusive' or all versions of Outlook, please refer back to the FAQ script.

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

Top
#112273 - 2004-01-26 09:05 PM Re: Outlook/Exchange script help?
cwhitmore Offline
Starting to like KiXtart

Registered: 2001-05-23
Posts: 102
Loc: Austin, Texas, USA
Kent,
Can't I paste your script in where the existing Outlook10or11 code was on the "all inclusive" script?
That way I can use your code with the existing script?
Carlton.

Top
#112274 - 2004-01-26 09:38 PM Re: Outlook/Exchange script help?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
yes, you should be able to do that.. However, you will need to replace your Company Name, and the EXCHANGE server. If it looks like you cannot see the script, you may need to copy the code into Word, reselect it all and then paste it into your .KIX script.

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

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
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.064 seconds in which 0.025 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