#122113 - 2004-07-02 10:17 PM
Configuring the .prf file for Outlook
|
hbomb6
Fresh Scripter
Registered: 2004-06-22
Posts: 11
|
I can not get my script to correctly execute the WRITEPROFILESTRING method. I am not getting any error codes, but if I check that .prf file I see that nothing has been written either. CAN SOMEONE HELP ME PLEASE?
Here is part of that code, well at least the part that contains the code:
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
Edited by hbomb6 (2004-07-02 10:22 PM)
|
|
Top
|
|
|
|
#122116 - 2004-07-03 02:49 PM
Re: Configuring the .prf file for Outlook
|
hbomb6
Fresh Scripter
Registered: 2004-06-22
Posts: 11
|
Here is the rest except for the statements containing the Newprof.exe file, which creates the profile. Like you said there doesn't look like there is a syntax error and it didn't beep upon completion, but it still didn't write anything on the outlook.prf file.
;*********************************************** ; Determine correct Windows OS and assign Outlook ; profile location and windows directory location ; in the Registry accordingly. ;***********************************************
IF @inwin=1 $profilelocation=$userwinkey+' NT\CurrentVersion\Windows Messaging Subsystem\Profiles' $windir=READVALUE($machinewinkey+' NT\CurrentVersion','SystemRoot') ENDIF
IF EXIST("C:\scripts\outlook.prf") DEL "C:\scripts\outlook.prf" -s ENDIF
;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='10001' ; Editor Preference 10001=Plain Text, 20001=HTML, and 30001=Rich Text $company='Chestnut Health Systems' $serverloc=@lserver+'\Netlogon\Profgen\Outlook2000' ; Outlook Executables/files location $exchangeserver='E2k0301' ; Main Exchange Server Location $systemdrive=SUBSTR($windir,1,3) $scriptdir=$systemdrive+'\Scripts' $prf=@lserver+'\netlogon\sr-kixscripts\outlook.prf' $prffile=$scriptdir+'\'+$prf $ppru=$profilelocation+'\'+@userid $mses=$profilelocation+'\MS Exchange Settings'
;***************************************************** ; cHECKING FOR THE EXISTENCE OF A PROFILE, AND IF SO ; END THE SCRIPT, IF NOT CREATE ONE. ; ;*****************************************************
$ReturnCode = KEYEXIST($ppru)=1 OR KEYEXIST($mses)=1 IF $ReturnCode RETURN ELSE $exe=ReadValue($machinewinkey+'\CurrentVersion\App Paths\OUTLOOK.EXE','') $ver=GetFileVersion($exe) $pos_locat=INSTR($ver, '.') -1 $verchk=SUBSTR($ver,1,$pos_locat) IF EXIST($scriptdir)=0 MD $scriptdir ENDIF
COPY $prf $scriptdir
;************************************************** ; ; Assign an Exchange Server and profile information ; to the .prf file ; ;**************************************************
SELECT CASE IF $exchangeserver<>ReadProfileString($prffile,'Service2','HomeServer') WriteProfileString($prffile,'Service2','HomeServer',$exchangeserver) CASE IF @USERID<>READPROFILESTRING($prffile,'General','ProfileName') WriteProfileString($prffile,'General','ProfileName','@USERID') CASE IF @USERID<>READPROFILESTRING($prffile,'Service2','MailboxName') WriteProfileString($prffile,'Service2','MailboxName','@USERID') ENDSELECT
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
|
|
Top
|
|
|
|
#122119 - 2004-07-03 04:47 PM
Re: Configuring the .prf file for Outlook
|
hbomb6
Fresh Scripter
Registered: 2004-06-22
Posts: 11
|
what do you mean I'm not concatenating prffile
Les? Oh yeah, I forgot to include that I have a script that includes all of my global variables. Sorry I'm new at this
Edited by hbomb6 (2004-07-03 04:52 PM)
|
|
Top
|
|
|
|
#122122 - 2004-07-03 08:28 PM
Re: Configuring the .prf file for Outlook
|
hbomb6
Fresh Scripter
Registered: 2004-06-22
Posts: 11
|
I don't want to sound like an idiot, but it is just not sinking in. prffile=$scriptdir+'\'+$prf. $scriptdir is clearly C:\ and the location that I have for the $prf is good, because it works with other parts of the script. Again, I don't want to sound like an idiot. Here is my whole script, but I am only concerned about the Outlook section which is the last. ;******************************************************************************************************* ; Script Name: sr_master1.kix ; Author: Ron Hinton ; Date: 6/16/2004 ; Description: SR Master Kixscript for Printer Connections, Mapping Network Drives, and Outlook Profile ;*******************************************************************************************************
CALL "function.kix"
;Establish and put servers in use
$server1 = "\\srbdc01\" $server2 = "\\sr-bv\" $server3 = "\\sr-mv\" $server4 = "\\sr-psr\" $server5 = "\\sr-om1\" $server6 = "\\sr-em\" $server7 = "\\sr-ng\" $server8 = "\\E2k0301\"
;Establish subnets of SR Network to compare against computer IP addresses
$subnet1 = "192.168.30.0" $subnet2 = "192.168.40.0" $subnet3 = "192.168.60.0" $subnet4 = "192.168.80.0" $subnet5 = "192.168.100.0" $subnet6 = "192.168.110.0" $subnet7 = "192.168.120.0"
;******************** ;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\'
;* ;* Clear the screen, display message ;* CLS ?"Please wait for the login script to finish...."
; Sets the Login script as hidden. SetConsole("hide")
;Delete all network shares
use */DEL
;Set the time
SETTIME $server1
;* CHECK FOR EXISTANCE OF HOME DIRECTORY AND MAP P: IF IT EXISTS ;*
;IF InGroup ("\\chestnut.net\sr-users") ; ?USE P: "\\chestnut.net\sr-users\@USERID" ;ENDIF
;******************************************************************* ;Check for Departmental membership and map Network Drives Accordingly ;*******************************************************************
SELECT CASE INGROUP ("sr-mis") ?USE g: "\\chestnut.net\sr-datashare" ?USE Q: "\\srbdc01\NG-SharePoints" ?USE R: "\\sr-bv\BV-sharepoints" ?USE s: "\\sr-mv\sharepoints" ?USE t: "\\sr-om1\sharepoints" ?USE u: "\\sr-psr\sharepoints" ?USE Y: "\\srbdc01\mis" CASE INGROUP ("SR-Consultants") ?USE T: "\\srbdc01\BundyTB" ?USE X: "\\srbdc01\Programming" ?USE lpt2: "\\srbdc01\epsondfx" ?USE lpt3: "\\srbdc01\northgat" CASE InGroup("All-Southern Region") ?USE G: "\\chestnut.net\sr-datashare" CASE InGroup("sr-RR") ?Use F: "\\srbdc01\sys" CASE InGroup("sr-tb") ?Use M: "\\srbdc01\TB_Data" ?Use N: "\\srbdc01\AP_Data" ;CASE InGroup("All-SR-NG") ; ?CALL "default_NGgateway.kix" ENDSELECT
;Delete all Network printer connections.
Deltree ("HKEY_Current_User\printers\connections")
;************************************************************************** ; Add the appropriate printer based on workstation group membership, ; which in turn is based on location of the workstation in relationship ; to the network printers. ; ; The current location of workstaion group membership for the Southern ; Region is located in the Chestnut.net, SR, MIS-SR, Printer Groups OU. ; ;**************************************************************************
SELECT CASE ComputerInGroup('ng-print-unit') ? ADDPRINTERCONNECTION ("\\srbdc01\NG100-2200DN") CASE ComputerInGroup('NG-print-recept') ? ADDPRINTERCONNECTION ("\\srbdc01\NG105-Laser") CASE ComputerInGroup('NG-print-OP') ? ADDPRINTERCONNECTION ("\\srrbdc01\NG143-Laser") CASE ComputerInGroup('NG-print-MIS') ? ADDPRINTERCONNECTION ("\\srbdc01\NG149-Laser") CASE ComputerInGroup('NG-print-MedRec') ? ADDPRINTERCONNECTION ("\\srbdc01\NG152-Laser") CASE ComputerInGroup('NG-print-MailRoom') ? ADDPRINTERCONNECTION("\\srbdc01\NG159-Laser") CASE ComputerInGroup('NG-print-CI') ? ADDPRINTERCONNECTION ("\\srbdc01\NG144-Crisis") CASE ComputerInGroup('NG-print-CD') ? ADDPRINTERCONNECTION ("\\srbdc01\NG312-CD") CASE ComputerInGroup('NG-print-Admin') ? ADDPRINTERCONNECTION ("\\srbdc01\NG209-Admin") CASE ComputerInGroup('NG-print-Acct') ? ADDPRINTERCONNECTION ("\\srbdc01\NG165-Accounting") ENDSELECT
SELECT CASE ComputerInGroup('MS-print-Housing') ? ADDPRINTERCONNECTION ("\\srbdc01\MS-Laser") CASE ComputerInGroup('MV-print-MedRec') ? ADDPRINTERCONNECTION ("\\sr-mv\MV105-Laser") CASE ComputerInGroup('MV-print-Admin') ? ADDPRINTERCONNECTION ("\\sr-mv\MV314-Laser") CASE ComputerInGroup('MV-print-LI') ? ADDPRINTERCONNECTION ("\\sr-mv\MV308-Laser") CASE ComputerInGroup('om-print-act') ? ADDPRINTERCONNECTION ("\\sr-om1\OM-Laser") ENDSELECT
SELECT CASE ComputerInGroup('EM-print') ? ADDPRINTERCONNECTION ("\\sr-em\EM-Laser") CASE ComputerInGroup('FH-print') ? ADDPRINTERCONNECTION ("\\sr-fh1\HPLaser") CASE ComputerInGroup('ED-print-Level1') ? ADDPRINTERCONNECTION ("\\sr-psr\ED-MedRec") CASE ComputerInGroup('ED-print-Level2') ? ADDPRINTERCONNECTION ("\\sr-psr\ED-PSR-Level2") CASE ComputerInGroup('ED-print-Level3') ? ADDPRINTERCONNECTION ("\\sr-psr\ED-CM-Laser") ENDSELECT
SELECT CASE ComputerInGroup('BV-print-Reception') ? ADDPRINTERCONNECTION ("\\sr-bv\BV-Reception-HP4100") CASE ComputerInGroup('BV-print-CM') ? ADDPRINTERCONNECTION ("\\sr-bv\BV-CM-LJ2300DTN") CASE ComputerInGroup('BV-print-MedRec') ? ADDPRINTERCONNECTION ("\\sr-bv\Canon-MedRec") CASE ComputerInGroup('BV-print-Adm') ? ADDPRINTERCONNECTION ("\\sr-bv\Canon-Admin") CASE ComputerInGroup('BV-print-OP') ? ADDPRINTERCONNECTION ("\\sr-bv\BV-OP-LJ4100") ENDSELECT
;*********************************************** ; Determine correct Windows OS and assign Outlook ; profile location and windows directory location ; in the Registry accordingly. ;***********************************************
IF @inwin=1 $profilelocation=$userwinkey+' NT\CurrentVersion\Windows Messaging Subsystem\Profiles' $windir=READVALUE($machinewinkey+' NT\CurrentVersion','SystemRoot') ENDIF
DEL "C:\scripts\outlook.prf"
;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='10001' ; Editor Preference 10001=Plain Text, 20001=HTML, and 30001=Rich Text $company='Chestnut Health Systems' $serverloc=@lserver+'\Netlogon\Profgen\Outlook2000' ; Outlook Executables/files location $exchangeserver='E2k0301' ; Main Exchange Server Location $systemdrive=SUBSTR($windir,1,3) $scriptdir=$systemdrive+'\Scripts' $prf=@lserver+'\netlogon\sr-kixscripts\outlook.prf' $prffile=$scriptdir+'\'+$prf $ppru=$profilelocation+'\'+@userid $mses=$profilelocation+'\MS Exchange Settings'
;***************************************************** ; cHECKING FOR THE EXISTENCE OF A PROFILE, AND IF SO ; END THE SCRIPT, IF NOT CREATE ONE. ; ;*****************************************************
$ReturnCode = KEYEXIST($ppru)=1 OR KEYEXIST($mses)=1 IF $ReturnCode RETURN ELSE $exe=ReadValue($machinewinkey+'\CurrentVersion\App Paths\OUTLOOK.EXE','') $ver=GetFileVersion($exe) $pos_locat=INSTR($ver, '.') -1 $verchk=SUBSTR($ver,1,$pos_locat) IF EXIST($scriptdir)=0 MD $scriptdir ENDIF
COPY $prf $scriptdir
;************************************************** ; ; Assign an Exchange Server and profile information ; to the .prf file ; ;**************************************************
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
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
|
|
Top
|
|
|
|
#122126 - 2004-07-04 05:34 AM
Re: Configuring the .prf file for Outlook
|
hbomb6
Fresh Scripter
Registered: 2004-06-22
Posts: 11
|
The part that doesn't sink in is how is \Scripts\\\DC\Netlogon\sr-kixscripts\outlook.prf is different from $scriptdir+'\'$prf when scriptdir=c:\Scripts and prf=@lserver\netlogon\sr-kixscripts\outlook.prf. Like I said that path works because my copy command in the script finds the outlook.prf file there. So what am I doing wrong? Do I not supposed to add the + sign or what. I mean I defined both of those variables.
|
|
Top
|
|
|
|
#122129 - 2004-07-08 03:04 PM
Re: Configuring the .prf file for Outlook
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Sorry about jumping in a little late in the game..
You are missing $userwinkey and $machinewinkey. Code:
$userwinkey='HKCU\Software\Microsoft\Windows' $machinewinkey='HKLM\Software\Microsoft\Windows'
Add this above - Code:
IF @inwin=1 $profilelocation=$userwinkey+' NT\CurrentVersion\Windows Messaging Subsystem\Profiles' $windir=READVALUE($machinewinkey+' NT\CurrentVersion','SystemRoot') ENDIF
HTH,
Kent
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Henriques)
and 2516 anonymous users online.
|
|
|