#68963 - 2002-08-27 04:07 PM
Re: Full extended Outlook script..
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
There was a posting to look for the @fullname in the Outlook Profile. This should address this request.
code:
BREAK ON CLS
$profile_remove = "Yes" ; -- 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? $fullname = "No" ; -- Option for @fullname rather than @userid
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,3) ; -- This will show C:\ or M:\ or what drive windows is installed on
; -- 19-August-2002 - Fixed detection problem, 0 = EXISTKEY with an OR Statment bombs on 3.63 $ppru = $profilelocation+"\"+@userid $pprf = $profilelocation+"\"+@fullname IF (ExistKey($ppru) = 0) OR (ExistKey($pprf) = 0) ;IF (ExistKey($ppru) = 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)
IF 1 <> EXIST($windir+"\Outlook.PRF") COPY @ldrive+"PROFGEN\RBMG\Outlook2000\Outlook.PRF" $windir ENDIF IF 1 <> EXIST ($windir+"\Profgen.exe") COPY @ldrive+"PROFGEN\RBMG\Outlook2000\Profgen.exe" $windir ENDIF IF 1 <> EXIST ($windir+"\NEWPROF.EXE") COPY @ldrive+"PROFGEN\RBMG\Outlook2000\NEWPROF.EXE" $windir ENDIF IF EXIST ($windir+"\FixPrf.EXE") DEL $windir+"\FixPrf.EXE" ENDIF IF EXIST($systemdrive+"PROFGEN.exe") DEL $systemdrive+"PROFGEN.EXE" ENDIF IF EXIST($systemdrive+"NEWPROF.EXE") DEL $systemdrive+"NEWPROF.EXE" ENDIF
; -- Set profile to be userid or fullname IF $fullname = "Yes" $rc = WRITEPROFILESTRING($windir+"\Outlook.PRF","General","ProfileName",@fullname) ELSE $rc = WRITEPROFILESTRING($windir+"\Outlook.PRF","General","ProfileName",@userid) ENDIF
SELECT ; -- Outlook 98 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 <> @fullname ; -- Going to check for @userid $rc = DELTREE($profilelocation+"\"+$keyname) ;$RC = DELKEY($ProfileLocation, $KeyName) $index = $index + 1 GOTO Loop3 ENDIF ENDIF ENDIF
;$returncode= EXISTKEY($pprofilelocation) OR EXISTKEY($pprofilelocationf) $returncode= EXISTKEY($ppru) IF $returncode <> 0 ; -- If you use RUN instead of SHELL, the script will pause and not complete properly SHELL "%COMSPEC% /C "+$windir+"\Profgen.exe "+$windir+"\NEWPROF.EXE -P "+$windir+"\Outlook.PRF" SLEEP 1 $rc = writevalue($profilelocation, "DefaultProfile", @userid, "REG_SZ") ENDIF RETURN ; -- Outlook 2000 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 <> @fullname ; -- Going to check for @userid $rc = DELTREE($profilelocation+"\"+$keyname) ;$RC = DELKEY($ProfileLocation, $KeyName) $index = $index + 1 GOTO Loop4 ENDIF ENDIF ENDIF
; -- Generate the Inbox ; -- Make sure you use PUTINENV.EXE and WINSET.EXE with 9x machines - We need to have the %USERNAME% available
; -- If you use RUN instead of SHELL, the script will pause and not complete properly SHELL "%COMSPEC% /C "+$windir+"\Profgen.exe "+$windir+"\NEWPROF.EXE -P "+$windir+"\Outlook.PRF"
; -- 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 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
; -- Company $rc = WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\UserInfo","Company","4d00650072006900740061006700650020004d006f007200740067006100670065000000","REG_BINARY") ; -- 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 ; -- Outlook XP CASE $verchk = "10" ; -- If it is Outlook XP, configure the following keys and values ; -- No extra EXEs or files other than the PRF needed for Outlook XP $winntfile = $windir+"\Outlook.PRF"
; -- This is discussed at: http://www.slipstick.com/outlook/ol2002/prftips.htm IF "NO" <> READPROFILESTRING($winntfile,"General","BackupProfile") $rc = WRITEPROFILESTRING($winntfile,"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($winntfile,"General","ProfileName") ; $rc = WRITEPROFILESTRING($winntfile,"General","ProfileName",@userid) ;ENDIF
RUN $exe+" /importprf "+$winntfile ; -- 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 the 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
Cheers!
Kent
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1471 anonymous users online.
|
|
|