Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
{Edit - Removed the Company Key} Matt,
Give this a try...
Note the use of FIXPRF..
code:
;BREAK ON ;CLS ; -- Outlook 98/2000/XP Configuration ; -- Kent Dyer ; -- Updated 15-October - 2002 ; -- Tested with Kixtart - 3.63, 4.10, 4.02 ; -- Test Environments - NT 4.0, W2k, WXP ; -- Used some ideas from MCA's KIXnnnUPDATE.EXE script ; -- Visit: http://home.wanadoo.nl/scripting/ ; -- Originally created 15-August-2001 ; -- http://kixtart.org/board/ultimatebb.php?ubb=get_topic;f=10;t=000021 ; -- This completes the setup of Outlook ; -- Yes, you can use PROFGEN and FIXPRF, but these alone don't complete the setup ; -- They are, however necessary to complete this piece of the script ; -- Key points: ; -- * Changes the view to get rid of the Outlook Bar and show the "Explorer View" (optionally set) ; -- * Checks the box to empty deleted items on leaving Outlook (optionally set) ; -- * Also deletes bogus profiles like OEM User, etc. (optionally set) ; -- Changes Necessary: ; -- >>>> Company key needs to be changed to yours.... ; -- Comments and feedback are welcome to - dyerkb@myrealbox.com ; -- 27-August-2001 - Fixed Registry Key problem, CHKEXCHG.EXE - Not required ; -- 17-February-2002 - Added in compatibility for Windows 9x ; -- 12-March-2002 - Added Ability to turn on/off empty deleted items on exit and removal of bogus profiles ; -- 18-July-2002 - Added in the ability to configure Outlook XP, updated Micrsoft Links ; -- 15-August-2002 - Fixed detection problem, 0 = EXISTKEY with an OR Statment bombs on 3.63 ; -- 19-August-2002 - Increased testing with EXISTKEY and related changes ; -- 26-September-2002 - "Locked Down" user could not write to %windir%, created a C:\Scripts folder ; -- 03-October-2002 - Added in key to look for "MS Exchange Settings" as well as @userid ; -- 15-October-2002 - Re-Implemented FIXPRF.EXE for PROFILE Generation corrections ; -- 15-October-2002 - FIXPRF.EXE also is needed for generating the profile for Outlook XP as well ; -- 15-October-2002 - Quieted Profgen with a re-direct to nul - "> nul" ; -- 15-October-2002 - Completed Testing with Windows 9x ; -- 15-October-2002 - Use of more variables, changed @ldrive to @lserver for Win9x ; -- 15-October-2002 - Removed the Need for Winset, Putinenv for Windows 9x ; --- **** The following Resources were used in this composition **** ; --- &&&& URLS/Links updated and verified on 03 - October - 2002 &&&& --- ; -- http://www.microsoft.com/office/ork/2000/download/Outlook.prf - sample PRF file ; -- http://support.microsoft.com/default.aspx?scid=kb;EN-US;q182035 - Windows 95 roving users setup ; -- ftp://ftp.microsoft.com/bussys/exchange/exchange-unsup-ed/profgen.zip - Contains PROFGEN.EXE ; -- Automate Outlook Profile Creation Using PRFPATCH: ; -- http://www.microsoft.com/technet/archive/default.asp?url=/TechNet/archive/office/office97/deploy/prfpatch.asp ; -- http://www.microsoft.com/technet/downloads/exe/profile.exe - PRFPATCH.EXE, sample PRF File ; -- http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q145905 - NEWPROF command-line options ; -- http://www.microsoft.com/office/ork/appa/appa.htm - Microsoft Office 97 Resource Kit Tools and Utilities page ; -- http://www.microsoft.com/ntworkstation/downloads/Recommended/Featured/NTZAK.asp - Zero Administration Kit HomePage ; -- http://www.microsoft.com/ntworkstation/downloads/bin/zak/zak.exe - Download ZAK, Contains FIXPRF.EXE ; -- http://www.microsoft.com/office/ork/xp/journ/adminup.htm#Off2000 ; --- **** Outlook XP **** ; -- You can use GPO Editor for deployment of Outlook XP ; -- You should be able to issue the following command line: outlook.exe /importprf \\server1\share\outlook.prf ; -- Ref. http://www.microsoft.com/technet/treeview/default.asp?url=/TechNet/prodtechnol/office/officexp/reskit/officexp/part5/c18dpou.asp ; -- Look under: "Customizing an Outlook Installation" ; -- Outlook 2002 (Outlook XP) - http://www.slipstick.com/outlook/ol2002.htm ; -- D:\PFILES\COMMON\SYSTEM\MAPI\1033\95\NEWPROF.EXE - Office 2000 CD ; -- D:\PFILES\COMMON\SYSTEM\MAPI\1033\NT\NEWPROF.EXE - Office 2000 CD
; -- Program Settings, change as needed $profile_remove = "No" ; -- Profiles other than @USERID, like OEM User, MS Exchange Settings, etc. removed $deleteitems = "No" ; -- Do you want your users to delete all deleted items on Exit from Outlook? $explorview = "Yes" ; -- Do you want your users to view the "Explorer View" and not the Outlook bar in Outlook? $serverloc = @lserver+"\Netlogon\Profgen\Outlook2000" ; -- Server Location
; -- Environment variables $exchangeserver = "EXCHANGESERVER" ; -- Exchange 2000, should go to any Exchange server and re-direct as needed $prf = "Outlook.prf" ; -- PRF file
IF (@inwin = 1) ; -- Is it Winnt or 2K? ; -- Windows NT Registry Locations $profilelocation = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" $windir = READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion","SystemRoot") ELSE ; -- Windows 9x Registry Locations $profilelocation = "HKEY_CURRENT_USER\Software\Microsoft\Windows Messaging Subsystem\Profiles" $windir = READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion","SystemRoot") ENDIF
$systemdrive = SUBSTR($windir,1,2) ; -- This will show C: or M: or what drive windows is installed on $scriptdir = $systemdrive+"\Scripts" ; -- Script Directory $prffile = $scriptdir+"\"+$prf ; -- Shows c:\scripts\outlook.prf, for example ; -- 19-August-2002 - Fixed detection problem, 0 = EXISTKEY with an OR Statment bombs on 3.63 ; -- Thanks to MCA for the KixtartnnnUpdate.EXE script for this info ; -- You can find these at - http://home.wanadoo.nl/scripting/ $ppru = $profilelocation+"\"+@userid ; -- 03-October-2002 - Added in key to look for "MS Exchange Settings" $mses = $profilelocation+"\MS Exchange Settings" IF (ExistKey($ppru) = 0) OR (ExistKey($mses) = 0) RETURN ; -- Profile exists and return ELSE $exe = ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE","") $ver = GetFileVersion($exe) ; -- Get version of executable for MS-Outlook $pos_locat = INSTR($ver, ".") - 1 ; - Look for where the dot is $verchk = SUBSTR($ver,1,$pos_locat)
; -- Check to insure that the scripts folder is there ; -- 26-September-2002 - Found an issue with "Locked Down" user that could not write to %windir% IF GETFILEATTR($scriptdir) & 16 ELSE SHELL "%comspec% /c md "+$scriptdir ENDIF
; -- Before we begin, let's insure all needed files are in place
;IF 1 <> EXIST($windir+"\Outlook.PRF") ; -- Kent Dyer - 09/26/02 - Copy each time COPY $serverloc+"\"+$prf $scriptdir ;ENDIF IF 1 <> EXIST ($scriptdir+"\Profgen.exe") COPY $serverloc+"\Profgen.exe" $scriptdir ENDIF IF 1 <> EXIST ($scriptdir+"\NEWPROF.EXE") COPY $serverloc+"\NEWPROF.EXE" $scriptdir ENDIF IF 1 <> EXIST ($scriptdir+"\FIXPRF.EXE") COPY $serverloc+"\FIXPRF.EXE" $scriptdir ENDIF
; -- Depending on the version ($ver) detected above, go to the appropriate process SELECT CASE $verchk = "8" ; -- If it is Outlook 98, configure the following keys and values (e.g. 8.5.5104.0) IF $profile_remove = "YES" ; -- If it does not exist, delete out any odd-ball Profiles $index = 0 :loop3 $keyname = ENUMKEY($profilelocation, $index) IF @error = 0 ;? "Name found: $KeyName" ; -- Uncomment for debugging IF $keyname <> @userid OR $keyname <> "Sales" ; -- Going to check for @userid $rc = DELTREE($profilelocation+"\"+$keyname) ;$RC = DELKEY($ProfileLocation, $KeyName) $index = $index + 1 GOTO Loop3 ENDIF ENDIF ENDIF ;SHELL "%COMSPEC% /C "+$ScriptDir+"\Fixprf.exe "+$prfFile @userid @userid $ExchangeServer SHELL "%COMSPEC% /C "+$scriptdir+"\Fixprf.exe "+$prffile+" @userid @userid "+$exchangeserver SLEEP 1 IF (@inwin = 1) ; -- Is it Winnt or 2K? SHELL "%COMSPEC% /C "+$systemdrive+"\Scripts\Profgen.exe "+$systemdrive+"\Scripts\Newprof.exe -p "+$prffile+" -N -R -L > nul" ELSE ; -- Removed Profgen as it kills Windows 9x SHELL "%COMSPEC% /C "+$systemdrive+"\Scripts\Newprof.exe -p "+$prffile+" -N -R -L > nul" ENDIF ; -- If you use RUN instead of SHELL, the script will pause and not complete properly ;SHELL "%COMSPEC% /C "+$systemdrive+"\Scripts\Profgen.exe "+$systemdrive+"\Scripts\NEWPROF.EXE -P "+$prfFile+" > nul" SLEEP 1 $rc = writevalue($profilelocation, "DefaultProfile", @userid, "REG_SZ") RETURN CASE $verchk = "9" ; -- If it is Outlook 2000, configure the following keys and values (e.g. 9.0.0.2416) IF $profile_remove = "YES" ; -- If it does not exist, delete out any odd-ball Profiles $index = 0 :loop4 $keyname = ENUMKEY($profilelocation, $index) IF @error = 0 ;? "Name found: $KeyName" ; -- Uncomment for debugging IF $keyname <> @userid OR $keyname <> "Sales" ; -- Going to check for @userid $rc = DELTREE($profilelocation+"\"+$keyname) ;$RC = DELKEY($ProfileLocation, $KeyName) $index = $index + 1 GOTO Loop4 ENDIF ENDIF ENDIF ; -- Generate the Inbox SHELL "%COMSPEC% /C "+$scriptdir+"\Fixprf.exe "+$prffile+" @userid @userid "+$exchangeserver SLEEP 1 IF (@inwin = 1) ; -- Is it Winnt or 2K? SHELL "%COMSPEC% /C "+$scriptdir+"\Profgen.exe "+$scriptdir+"\Newprof.exe -p "+$prffile+" -N -R -L > nul" ELSE SLEEP 1 ; -- Removed Profgen as it kills Windows 9x SHELL "%COMSPEC% /C "+$scriptdir+"\Newprof.exe -p "+$prffile+" -N -R -L > nul" ENDIF ; -- If you use RUN instead of SHELL, the script will pause and not complete properly ;SHELL "%COMSPEC% /C "+$ScriptDir+"\Profgen.exe "+$ScriptDir+"\NEWPROF.EXE -P "+$prfFile+" > nul" ; -- Had to add a small pause SLEEP 1 $rc = writevalue($profilelocation, "DefaultProfile", @userid, "REG_SZ")
; -- Check for the Default profile, if it does not exist, create it IF @userid <> READVALUE( $profilelocation, "DefaultProfile" ) $rc = WRITEVALUE ($profilelocation, "DefaultProfile", @userid, "REG_SZ") ENDIF
; -- Check the box to empty deleted items on leaving Outlook - Now the we have the Outlook Profile Generated ; -- Note: $mses should not come into play here as "MS Exchange Settings" would indicate that this mailbox has ; -- already been completed IF $deleteitems = "Yes" IF "0100" <> READVALUE($ppru+"\0a0d020000000000c000000000000046","000b0115") $rc = WRITEVALUE($ppru+"\0a0d020000000000c000000000000046","000b0115","0100","REG_BINARY") ENDIF ENDIF
; -- Changes the view to get rid of the Outlook Bar and show the "Explorer View" IF $explorview = "Yes"
; -- CHECK FOR KEYS AND IF NEED BE, ADD THEM ; --- Check for the right keys IF 0 <> EXISTKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0") $rc = ADDKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0") ENDIF IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0") $rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0") ENDIF IF 0 <> EXISTKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Common") $rc = ADDKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Common") ENDIF IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common") $rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common") ENDIF IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Preferences") $rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Preferences") ENDIF IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\UserInfo") $rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\UserInfo") ENDIF IF 0 <> EXISTKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook") $rc = ADDKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook") ENDIF IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options") $rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options") ENDIF IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options\Mail") $rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options\Mail") ENDIF IF 0 <> EXISTKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup") $rc = ADDKEY("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup") ENDIF IF 0 <> EXISTKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Office Explorer") $rc = ADDKEY("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Office Explorer") ENDIF
; -- Set the Machine Name IF @wksta <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","Machine Name") $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","Machine Name",@wksta,"REG_SZ") ENDIF ; -- Check Internet E-Mail Accounts IF 1 <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","CheckInternetAccounts") $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","CheckInternetAccounts","1","REG_DWORD") ENDIF ; -- Has Outlook been Setup? IF "False" <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","FirstRunDialog") $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook","FirstRunDialog","False","REG_SZ") ENDIF ; -- Primary Client? IF 1 <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Setup","PrimaryClient") $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Setup","PrimaryClient","1","REG_DWORD") ENDIF ; -- Corporate or POP3? - Needs to be a machine setting IF 1 <> READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup","MailSupport") $rc = WRITEVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup","MailSupport","1","REG_DWORD") ENDIF ; -- Corporate or POP3? - Needs to be a machine setting IF 1 <> READVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup","First-Run") $rc = WRITEVALUE("HKEY_LOCAL_MACHINE\Software\Microsoft\Office\9.0\Outlook\Setup","First-Run","df83b12adc9cd511b57c0002a57ce19c","REG_BINARY") ENDIF
; -- Set the default mail preference as Rich Text format 1996609 is Word, 199610 Rich Text Format IF "196610" <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options\Mail","EditorPreference") $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Options\Mail","EditorPreference","196610","REG_DWORD") ENDIF
$rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\"+@userid+"\0a0d020000000000c000000000000046","001e0360","","REG_SZ")
; -- Changes the view to get rid of the Outlook Bar and show the "Explorer View" $expview = "010000002c0000000200000003000000ffffffffffffffffffffffffffffffff62000000270000003" $expview = $expview + "c030000ac02000001000000000000000100000000000000c00000006400000003000000" $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Office Explorer","Frame",$expview,"REG_BINARY")
; -- Set the default Font to be Verdana 10 pt $pltextfont = "3c0000000f0000e800000040c80000000600000000000000002056657264616e6100020000000000000000" $pltextfont = $pltextfont + "0000000000201a493a38e9070001000000" $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Preferences","PlainTextFont",$pltextfont,"REG_BINARY") ENDIF RETURN CASE $verchk = "10" ; -- If it is Outlook XP, configure the following keys and values
; -- This is discussed at: http://www.slipstick.com/outlook/ol2002/prftips.htm IF "NO" <> READPROFILESTRING($prffile,"General","BackupProfile") $rc = WRITEPROFILESTRING($prffile,"General","BackupProfile","NO") ENDIF
; -- This is discussed at the bottom of - http://www.microsoft.com/office/ork/xp/four/outc03.htm $rc=WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Setup","ImportPRF",$winntfile,"REG_SZ")
; -- Change the PRF file from %username% to @userid IF @userid <> READPROFILESTRING($prffile,"General","ProfileName") $rc = WRITEPROFILESTRING($prffile,"General","ProfileName",@userid) ENDIF
; -- Fix the Profile SHELL "%COMSPEC% /C "+$scriptdir+"\Fixprf.exe "+$prffile+" @userid @userid "+$exchangeserver SLEEP 1 RUN $exe+" /importprf "+$prffile ; -- Import the profile for outlook SLEEP 1
; -- Set the default mail preference as Rich Text format 1996609 is Word, 199610 Rich Text Format IF "196610" <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Options\Mail","EditorPreference") $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Options\Mail","EditorPreference","196610","REG_DWORD") ENDIF
; -- Set the default Font to be Verdana 10 pt $pltextfont = "3c0000000f0000e800000040c80000000600000000000000002056657264616e6100020000000000000000" $pltextfont = $pltextfont + "0000000000201a493a38e9070001000000" $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Preferences","TextFontSimple",$pltextfont,"REG_BINARY")
; -- Changes the view to get rid of the Outlook Bar and show the "Explorer View" IF $explorview = "Yes" $expview = "010000002c0000000200000003000000ffffffffffffffffffffffffffffffff2c0000002c00000084" $expview = $expview + "020000dc01000001000000000000000100000000000000c0000000640000001800000003000000" $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Office Explorer","Frame",$expview,"REG_BINARY") ENDIF
; -- Check the box to empty deleted items on leaving Outlook - Now that we have the Outlook Profile Generated IF $deleteitems = "Yes" IF "1" <> READVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Preferences","EmptyTrash") $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Preferences","EmptyTrash","1","REG_DWORD") ENDIF ENDIF
RETURN ENDSELECT ENDIF
HTH,
Kent [ 15. October 2002, 23:51: Message edited by: kdyer ]
|