NuclearKitten
(Fresh Scripter)
2006-12-08 04:38 PM
Help with outlook script

I'm trying to use Kyders script for automatic outlook configuration. I just can't seem to get it to work. I'm basically trying to get my enterprise away from batch scripts so I'm redoing everything with kixtart. I've got the drive mappings and citrix config working perfectly, but this outlook script is giving me some trouble.
environment:
Exchange 2003
Server 2003 Ent.
Clients are win2K w/outlook 2002
The exchange server name is: EXCHANGE1
Here is the script:
Code:
FUNCTION OUTLOOK()
     DIM $prfrem,$waste,$explorview,$editorpref,$prf,$serverloc,
    $exchgsvr,$prfloc,$prffile,$ppru,$exe,$ver,$idx,$keyname,$rc,
    $outlook,$ns,$unread,$fldr,$x,$regexp,$MSOdir

    $waste='FALSE'    ; 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='Outlook.prf'
    $prffile='%temp%\'+$prf
    $serverloc=@LSERVER+'\Netlogon\Profgen' 
    $exchgsvr='EXCHANGE1'     
    IF @INWIN ;Windows NT/2k/XP/2003
       $prfloc='HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
    ENDIF
    ;Current User Profile
    $ppru=$prfloc+'\'+@USERID

    ;Determine version of Outlook
    $exe=ReadValue('HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE','')
    $ver=SPLIT(GetFileVersion($exe),'.')[0]+'.0'
    $MSOdir=SUBSTR($exe,1,Len($exe)-11)
    
    ;Look for Outlook Profile
    ;IF ReadValue($prfloc,'DefaultProfile')<>@USERID AND ReadValue($prfloc,'DefaultProfile')<>'MS Exchange Settings' OR @ERROR
    IF (ReadValue($prfloc,'DefaultProfile')<>@USERID AND NOT INSTR(ReadValue($prfloc,'DefaultProfile'),'MS Exchange')) OR @ERROR
       COPY $serverloc+'\'+$prf $prffile
       $rc=WriteProfileString($prffile,'General','ProfileName',@USERID)
       $rc=WriteProfileString($prffile,'General','DefaultProfile','Yes')
       $rc=WriteProfileString($prffile,'General','OverwriteProfile','Yes')
       $rc=WriteProfileString($prffile,'General','BackupProfile','No')
       $rc=WriteProfileString($prffile,'Service1','AutoNameCheck','TRUE')
       $rc=WriteProfileString($prffile,'Service1','EmptyWastebasket',$waste)
       $rc=WriteProfileString($prffile,'Service1','CloseOriginalMessage','TRUE')
       $rc=WriteProfileString($prffile,'Service2','HomeServer',$exchgsvr)
       $rc=WriteProfileString($prffile,'Service2','MailboxName',@USERID)

       SELECT
       CASE
          $ver='8.0' OR $ver='9.0' ;(e.g. 8.5.5104.0)
          SHELL '%COMSPEC% /C '+$serverloc+'\newprof.exe -p '+$prffile+' -x'
          $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook','Machine Name',@WKSTA,'REG_SZ')
          $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook','CheckInternetAccounts',1,'REG_DWORD')
          $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook','FirstRunDialog','False','REG_SZ')
          $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','PrimaryClient',1,'REG_DWORD')
          $rc=WriteValue('HKLM\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','MailSupport',1,'REG_DWORD')
          $rc=WriteValue('HKLM\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','First-Run','df83b12adc9cd511b57c0002a57ce19c','REG_BINARY')
          IF $explorview='Yes'
             $rc=WriteValue($prfloc+@userid+'\0a0d020000000000c000000000000046','001e0360','','REG_SZ')
             $expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff62000000270000003'
             $expview=$expview+'c030000ac02000001000000000000000100000000000000c00000006400000003000000'
             $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY')
          ENDIF
       CASE


And here is the prf:

Code:


; ************************************************************************
; Section 1 - Profile defaults.
; ************************************************************************

[General]
Custom=1
; -- Required.  Indicates that this is a customized PRF file.
ProfileName=Microsoft Outlook
DefaultProfile=Yes
OverwriteProfile=Yes
DefaultStore=Service2

; ************************************************************************
; Section 2 - Services in profile.
; ************************************************************************
; The list of MAPI services that will be added to the profile.

[Service List]
Service1=Microsoft Outlook Client
Service2=Microsoft Exchange Server
Service3=Outlook Address Book
Service4=Personal Folders
; Service5=Internet E-mail
; If you add an Internet E-mail service, you also have to add an Account in
; section 3.

; ************************************************************************
; Section 3 - List of internet accounts.
;*******************************************************************
; The list of accounts that will be created.

[Internet Account List]
; Account1=I_Mail

; ************************************************************************
; Section 4 - Default values for each service.
; ************************************************************************

[Service1]
;	No settings configured.

[Service2]
ConversionProhibited=TRUE
HomeServer=Exchange1
;       Required.
;	--  The name of the Microsoft Exchange Server the user should
;	connect to.  You can specify any Microsoft Exchange Server
;	in your site, and the correct Home Server will be assigned 
;	when the user first logs on.

[Service3]
Ben=TRUE
;	--  Dummy property.  Do not delete or modify.

[Service4]
PathToPersonalFolders=c:\outlook.pst
; The directories in the path to the personal folders must already exist

[Service5]
AccountName=PopAccount
' The AccountName has to match the Account name in Section 5.
LongAccountName=Internet E-mail - PopAccount
; The LongAccountName always has to be "Internet E-mail -" + <space> + AccountName

; ************************************************************************
; Section 5 - Values for each internet account.
; *******************************************************************
; The settings for each account that will be created. The available
; account settings are listed in Section 3, below.

[Account1]
; This is an example of a POP3 account
AccountName=PopAccount
ConnectionType=1
POP3Server=MyPOPServer
SMTPDisplayName=Someone
SMTPEmailAddress=someone@microsoft.com
SMTPOrgName=Personal
SMTPServer=MySMTPServer

; ************************************************************************
; Section 6 - Mapping for profile properties.  DO NOT MODIFY.
; ************************************************************************

; ************************************************************************
; Outlook settings stored in the profile
[Microsoft Outlook Client]
SectionGUID=0a0d020000000000c000000000000046

FormDirectoryPage=PT_STRING8,0x0270
;	-- The URL of Exchange Web Services Form Directory page used to
;	create Web forms.

WebServicesLocation=PT_STRING8,0x0271
;	-- The URL of Exchange Web Services page used to display
;	unknown forms.

ComposeWithWebServices=PT_BOOLEAN,0x0272
;	-- Set to TRUE to use Exchange Web Services to compose forms.

PromptWhenUsingWebServices=PT_BOOLEAN,0x0273
;	-- Set to TRUE to use Exchange Web Services to display unknown
;	forms.

OpenWithWebServices=PT_BOOLEAN,0x0274
;	-- Set to TRUE to prompt user before opening unknown forms when
;	using Exchange Web Services.

; ************************************************************************
; Microsoft Exchange Server service definitions.
[Microsoft Exchange Server]
ServiceName=MSEMS
MDBGUID=5494A1C0297F101BA58708002B2A2517

MailboxName=PT_STRING8,0x6607
;	-- The name of the user's Exchange Server Mailbox

HomeServer=PT_STRING8,0x6608
;	-- The name of the Microsoft Exchange Server the user should
;	connect to.  You can specify any Microsoft Exchange Server
;	in your site, and the correct Home Server will be assigned 
;	when the user first logs on.

OfflineFolderPath=PT_STRING8,0x6610
;       -- The path to the Offline Store File that contains
;       local replicas of the user's Mailbox and Favorites.
;       If you do not specify a value, no Offline Store will
;       be created.  If you specify a path, an Offline Store
;       will be created and the Inbox, Outbox, Deleted Items,
;       and Sent Items folders will be replicated to it.

OfflineAddressBookPath=PT_STRING8,0x660E
;	-- The path to the directory to store offline address
;	book files in.

ExchangeConfigFlags=PT_LONG,0x6601
;       -- Behavior when connecting to the Exchange Server.
;	32 - Auto detect online/offline connection state (default)
;	48 - Always connect online
;	50 - Prompt user for online or offline connection

ConversionProhibited=PT_BOOLEAN,0x3A03
;       -- A boolean value indicating whether NEWPROF should
;       attempt to resolve the Exchange mailbox name at run time. 
;       If set to TRUE, NEWPROF will copy the name to the profile
;       without resolving it.
;       If FALSE, the name will be resolved. Invalid server or 
;       mailbox name will not be copied to the profile.

; ************************************************************************
; Microsoft Mail service definitions.
[Microsoft Mail]
ServiceName=MSFS

ServerPath=PT_STRING8,0x6600
;      --  The path to the users post office.  Mapped network drives, UNC and NETWARE paths
;          are acceptable.  NETWARE paths of the type NWServer/share:dir\dir1 are converted to 
;          UNC paths of the type \\NWServer\share\dir\dir1. 

Mailbox=PT_STRING8,0x6601
;      --  The users mailbox name.  eg. in a NET/PO/USER address,
;          this is USER.  The maximum mailbox name is 10 characters.

Password=PT_STRING8,0x67f0
;      --  The users mailbox password.  The maximum password is 8 characters.

RememberPassword=PT_BOOLEAN,0x6606
;      --  A boolean value indicating whether the users password is
;          to be remembered in the profile or not.  This is useful because
;          if the password is remembered the user can bypass the logon prompt
;          if his server path, mailbox name and password are all supplied.

ConnectionType=PT_LONG,0x6603
;      --  The connection type.  This may be one of CFG_CONN_AUTO, CFG_CONN_LAN,
;          CFG_CONN_REMOTE, CFG_CONN_OFFLINE as defined below.
;
;          0x0         --  LAN type connection.  Used to connect to the post office using a
;                          UNC path or pre-existing mapped drive.
;          0x1         --  Dial up connection using Dial-up Networking.
;          0x2         --  Not connected.
;          0x3         --  Automatically detect whether the connection type is LAN or REMOTE.
;                          This connection type is only available on Win95.

UseSessionLog=PT_BOOLEAN,0x6604
;      --  A boolean value indicating whether session logging
;          is on or off.

SessionLogPath=PT_STRING8,0x6605
;      --  The path to the session log file.

EnableUpload=PT_BOOLEAN,0x6620
;      --  A boolean value which indicates whether mail in the outbox
;          is sent.

EnableDownload=PT_BOOLEAN,0x6621
;      --  A boolean value which indicates whether mail in the server
;          mailbag is downloaded.

UploadMask=PT_LONG,0x6622
;      --  A bit array which allows the user to indicate which addresses
;          for which the transport is to attempt delivery.  This is useful
;          in order to allow a user to specify that a transport only handle
;          delivery for a subset of the addresses it can really process.
;          When multiple transports are installed and the user wants a
;          different transport to handle some specific address types they
;          can use this bit array to specify that the MSMAIL transport
;          only handle a specific set of addresses.
;
;          Possible values as defined below include:
;
;          0x00000001      --  Local Post Office and External Post Office address types
;          0x00000002      --  PROFS address types
;          0x00000004      --  SNADS address types
;          0x00000008      --  MCI address types
;          0x00000010      --  X.400 address types
;          0x00000040      --  FAX address types
;          0x00000080      --  MHS address types
;          0x00000100      --  SMTP address types
;          0x00000800      --  OfficeVision address types
;          0x00001000      --  MacMail address types
;          0x000019df      --  All of the above address types

NetBiosNotification=PT_BOOLEAN,0x6623
;      --  A boolean value which indicates whether a netbios notification
;          is sent to a recipients transport when mail is delivered to
;          their server inbox.

NewMailPollInterval=PT_STRING8,0x6624
;      --  The polling interval in minutes when the transport
;          checks for new mail.  1 <= polling interval <= 9999

DisplayGalOnly=PT_BOOLEAN,0x6625
;      --  A boolean value which, if TRUE, only displays the Microsoft Mail Global Address
;          list for name selection.  The Postoffice list, external post office lists, and gateway
;          address lists are not shown.

UseHeadersOnLAN=PT_BOOLEAN,0x6630
;      --  A boolean value which indicates whether the user wants to enable
;          headers while working on the LAN.  Headers mode allows the user
;          to download message headers and selectively choose which mail
;          to download.

UseLocalAdressBookOnLAN=PT_BOOLEAN,0x6631
;      --  A boolean value which indicates whether the user wants to use
;          name resolution based on a local copy of the server address book
;          rather than the server address book itself.

UseExternalToHelpDeliverOnLAN=PT_BOOLEAN,0x6632
;      --  A boolean value which indicates whether EXTERNAL.EXE, a server process, should be used
;          to deliver submitted mail messages.  This is sometimes useful when mail is running 
;          on a slow LAN connection.

UseHeadersOnRAS=PT_BOOLEAN,0x6640
;      --  A boolean value which indicates whether the user wants to enable
;          headers while working over a slow speed link.  Headers mode
;          allows the user to download message headers and selectively
;          choose which mail to download.

UseLocalAdressBookOnRAS=PT_BOOLEAN,0x6641
;      --  A boolean value which indicates whether the user wants to use
;          name resolution based on a local copy of the server address book
;          rather than the server address book itself.

UseExternalToHelpDeliverOnRAS=PT_BOOLEAN,0x6639
;      --  A boolean value which indicates whether EXTERNAL.EXE, a server process, should be used
;          to deliver submitted mail messages.  This speeds up message delivery when mail is
;          running on a Dial-up network connection.

ConnectOnStartup=PT_BOOLEAN,0x6642
;      --  A boolean value which indicates that a Dial-up Network connection should
;          be established when the transport provider starts up.

DisconnectAfterRetrieveHeaders=PT_BOOLEAN,0x6643
;      --  A boolean value which indicates that a Dial-up Network connection should
;          be automatically terminated when headers are finished downloading.

DisconnectAfterRetrieveMail=PT_BOOLEAN,0x6644
;      --  A boolean value which indicates that a Dial-up Network connection should
;          be automatically terminated after mail has finished being sent
;          received.

DisconnectOnExit=PT_BOOLEAN,0x6645
;      --  A boolean value which indicates that a Dial-up Network connection should
;          be automatically terminated when the provider is exited.

DefaultDialupConnectionName=PT_STRING8,0x6646
;      --  The name of the Dial-up Network profile that the transport will use by
;          default to attempt the connection.

DialupRetryCount=PT_STRING8,0x6648
;      --  Number of times to attempt dial for connection.
;          1 <= retry attempts <= 9999

DialupRetryDelay=PT_STRING8,0x6649
;      --  Delay between retry attempts in seconds.
;          30 <= retry delay <= 9999

; ************************************************************************
; Personal Folders service definitions.

[Personal Folders]
ServiceName=MSPST MS

PathToPersonalFolders=PT_STRING8,0x6700 
;      --  Path to personal folders.

RememberPassword=PT_BOOLEAN,0x6701
;      --  A boolean value that determines if the personal folders password
;          should be cached.

EncryptionType=PT_LONG,0x6702
;      --  A value that designates the type of encryption that is used to
;          compress the data in the PST:
;
;          No Encryption              0x80000000
;          Compressable Encryption    0x40000000
;          Best Encryption            0x20000000

Password=PT_STRING8,0x6703
;      --  PST password.

; ************************************************************************
; Outlook Address Book service definitions.

[Outlook Address Book]
ServiceName=CONTAB
Ben=PT_STRING8,0x6700
;      --  Dummy property.  Do not modify.

; ************************************************************************
; Microsoft LDAP Directory service definitions.
[Microsoft LDAP Directory]
ServiceName=EMABLT

LDAPServer=PT_STRING8,0x6600
;	-- This is the IP address or host name of the machine containing
;	the LDAP server.

LDAPServerPort=PT_STRING8,0x6601
;	-- The port number that the LDAP server is listening on.

UserName=PT_STRING8,0x6602
; 	-- Enter the user's name. This value is not required if you allow
;	anonymous binds.

SearchBase=PT_STRING8,0x6603
;	-- The Search Base (e.g. o=microsoft, c=US).

SearchFilter=PT_STRING8,0x6604
;	-- The Search Filter in RFC1777 format with %s allowed as a
;	substitution token for the name to be searched for. For example,
;	(|(cn=*%s*)(sn=*%s*)) can be used to perform a search on common name
;	or surname.

MAPIAddressType=PT_STRING8,0x6605
;	-- The address type to be used by MAPI in message submission. For
;	example, SMTP.

EMailAttribute=PT_STRING8,0x6606
;	-- The E-Mail Attribute (e.g. mail, mhsOrAddresses or
;	rfc822Mailbox), which is mapped to the MAPI PR_EMAIL_ADDRESS property.

LDAPTimeLimit=PT_STRING8,0x6607
;	-- LDAP Time Limit for searching (in seconds). The maximum length of
;	time to search the directory. A value of 0 means that the search will
;	not be limited by time. Note that this will not necessarily supersede
;	any system-wide limits defined on the server.

LDAPSizeLimit=PT_STRING8,0x6608
;	-- LDAP Size limit for searching (in number of 'hits'). The maximum
;	number of matches to return. A value of 0 means that there is no
;	limit to the number of matches. Note that this will not necessarily
;	supersede any system-wide limits defined on the server.

LDAPTimeLimitLowBand=PT_STRING8,0x6609
;	-- Same as LDAP Time Limit, except for low bandwidth links.

LDAPSizeLimitLowBand=PT_STRING8,0x660a
;	-- Same as LDAP Size Limit, except for low bandwidth links.

LogFilePath=PT_STRING8,0x660b
;	-- Log File (full pathname).

ErrorLogging=PT_STRING8,0x660c
;	-- Error Logging Levels , ON or OFF.

DisplayNameSource=PT_STRING8,0x6611
;	-- Attribute to be used within the Internet Directory entry for
;	populating the user Display Name.

DisplayFailDialog=PT_STRING8,0x6612
;	-- Attribute to determine if a dialog will be displayed when a search
;	to the Internet Directory fails. The dialog will display additional
;	information. Values can be either 1 (display) or 0 (do not display).

[Internet E-Mail]
; If you configure an Internet E-mail service, then you also need to add
; information in section 5.

ServiceName=IMAIL
; When creating an Internet E-Mail service, both AccountName and
; LongAccountName MUST BE specified!

AccountName=PT_STRING8,0x661f
; This should be exactly the same as the I_Mail AccountName
; property.

LongAccountName=PT_STRING8,0x3001
; This should be the "Internet E-mail - " + the AccountName
; property. For example, if AccountName="foo", then this
; should be "Internet E-mail - foo".

; ************************************************************************
; Section 7 - Mapping for internet account properties.  DO NOT MODIFY.
; ************************************************************************

; Internet E-Mail service Settings/Definitions
; In a Corporate or Workgroup configuration, the only type of account that
; can be created is an I_MAIL (POP3) account. You can use settings from 
; the [I_Mail] section below.
; 

[I_Mail]
; *****************************
; *** Mail Account Settings ***
; *****************************
; Configurable settings for POP3 (Corporate and Intenet Only configs)
; and IMAP (Internet Only config only) mail accounts

AccountName=PT_STRING8,0x1235
; The name of the account that appears in the Account List.

ConnectionType=PT_DWORD,0x1239
; Values:
; 0 = Connect using local area network (LAN).
; 1 = Connect using Internet Explorer's or a 3rd party dialer.
; 2 = Connect using modem and the Dial-up Networking connection
;       specified in the Connectoid property.

Connectoid=PT_STRING8,0x123A
; Specify the existing Dial-up Networking connection to use.

; -----------------------------
; --- POP3 Account Settings ---
; -----------------------------

POP3Server=PT_STRING8,0x13C4
; Specifies the name of the POP3 server used for incoming messages.

POP3UseSicily=PT_BOOLEAN,0x13C8
; Set to 1 if you want to use Secure Password Authentication to logon
; to the POP3 server.

POP3LogonName=PT_STRING8,0x13C5
; If POP3UseSicily is turned on, this sets the name used to logon
; to the POP3 server.

POP3Port=PT_DWORD,0x13C9
; Specfies the port number used to connect to the POP3 server.

POP3SSL=PT_BOOLEAN,0x13CA
; Set to 1 to use the SSL (Secure Sockets Layer) security protocal to
; connect to the POP3 server.

POP3TimeOut=PT_DWORD,0x13CB
; Specifies how long to wait for a response for the server before
; stopping to attempt to send or receive messages. Possible values:
; 30 = 30 seconds
; 60 = 1 minute
; 90 = 1 minute 30 seconds
; 120 = 2 minutes
; 150 = 2 minutes 30 seconds
; 180 = 3 minutes
; 210 = 3 minutes 30 seconds
; 240 = 4 minutes
; 270 = 4 minutes 30 seconds
; 300 = 5 minutes

POP3LeaveOnServer=PT_BOOLEAN,0x13CC
; Set to 1 to store a copy of all sent and received messages on the
; POP3 server.

POP3RemoveExpired=PT_BOOLEAN,0x13CE
; If POP3LeaveOnServer is turned on, set to 1 to delete messages on
; the server after a specific number of days (see also
; POP3ExpireDays).

POP3ExpireDays=PT_DWORD,0x13CF
; If POP3LeaveOnServer and POP3RemoveExpired are turned on, sets
; the number of days after which messages left on the server will
; be deleted.

POP3RemoveDeleted=PT_BOOLEAN,0x13CD
; This property is only supported on Outlook 98 (8.5)or higher! If
; you try to use it on Outlook 97 (8.0x) the account will not be
; created.
; If POP3LeaveOnServer is turned on, set to 1 to delete a message
; from the server when the message is deleted from the Deleted
; Items folder on the local machine.

; -----------------------------
; --- SMTP Account Settings ---
; -----------------------------

SMTPServer=PT_STRING8,0x1428
; Specifies the name of the SMTP server used for outcoming messages.

SMTPUseSicily=PT_DWORD,0x142C
; Values:
; 0 = No server authentication required.
; 1 = Use Secure Password Authentication, or set SMTP server logon
;       name using SMTPLogonName.

SMTPLogonName=PT_STRING8,0x1429
; If SMTPUseSicily is set to 1, this sets the name used to logon to
; the SMTP server.

SMTPPort=PT_DWORD,0x142D
; Specfies the port number used to connect to the SMTP server.

SMTPSSL=PT_BOOLEAN,0x142E
; Set to 1 to use the SSL (Secure Sockets Layer) security protocal to
; connect to the SMTP server.

SMTPTimeOut=PT_DWORD,0x142F
; Specifies how long to wait for a response for the server before
; stopping to attempt to send or receive mail messages. Values are
;  the same as POP3TimeOut.

SMTPDisplayName=PT_STRING8,0x1430
; Specifies the "friendly" name associated with the email address.

SMTPOrgName=PT_STRING8,0x1431
; Specifies the group or organization.

SMTPEmailAddress=PT_STRING8,0x1432
; Specifies the email address. Must be in the format name@company

SMTPReplyAddress=PT_STRING8,0x1433
; Specifies that replies to outgoing email should be sent to this
; email address.

SMTPSplitMessages=PT_BOOLEAN,0x1434
; This property is only supported on Outlook 98 (8.5) or higher! If
; you try to use it on Outlook 97 (8.0x) the account will not be
; created.
; Set to 1 to break up outgoing messages, so that each message is
; smaller than the file size indicated by SMTPSplitSize.

SMTPSplitSize=PT_DWORD,0x1435
; The maximum size, in KB, of a piece of a split message.


Any help would be GREATLY appreciated...


NuclearKitten
(Fresh Scripter)
2006-12-08 07:39 PM
Re: Help with outlook script

anyone?

NuclearKitten
(Fresh Scripter)
2006-12-08 07:39 PM
Re: Help with outlook script

beuler?

NTDOCAdministrator
(KiX Master)
2006-12-08 07:49 PM
Re: Help with outlook script

NuclearKitten

I realize you may be in a rush or under pressure but multiple bumping of a topic especially in the same day is frowned upon on every board I've ever been on, including here.

The nature of this script has only a few members that are familiar with the whole process. You will have to be patient and wait for one of them to come by and see it and then see if they can offer you help.

Thanks guy.


LonkeroAdministrator
(KiX Master Guru)
2006-12-08 07:52 PM
Re: Help with outlook script

the end of the script seems to be missing...

Benny69
(MM club member)
2006-12-08 07:55 PM
Re: Help with outlook script

NuclearKitten,
In your first post you say you are having trouble with the outlook portion of your script but you don't say what trouble you are having, the folks that can help you are more likely to respond if you did.


NuclearKitten
(Fresh Scripter)
2006-12-11 06:09 PM
Re: Help with outlook script

it's not working at all. when i start outlook, i get the default profile configuration wizard...

NuclearKitten
(Fresh Scripter)
2006-12-12 03:58 PM
Re: Help with outlook script

there is no profile generated when the script executes. but it also doesn't return any errors.
here is the outlook.prf
Code:

; ************************************************************************
; Section 1 - Profile defaults.
; ************************************************************************

[General]
Custom=1
; -- Required.  Indicates that this is a customized PRF file.
ProfileName=Microsoft Outlook
DefaultProfile=Yes
OverwriteProfile=Yes
DefaultStore=Service2

; ************************************************************************
; Section 2 - Services in profile.
; ************************************************************************
; The list of MAPI services that will be added to the profile.

[Service List]
Service1=Microsoft Outlook Client
Service2=Microsoft Exchange Server
Service3=Outlook Address Book
Service4=Personal Folders
; Service5=Internet E-mail
; If you add an Internet E-mail service, you also have to add an Account in
; section 3.

; ************************************************************************
; Section 3 - List of internet accounts.
;*******************************************************************
; The list of accounts that will be created.

[Internet Account List]
; Account1=I_Mail

; ************************************************************************
; Section 4 - Default values for each service.
; ************************************************************************

[Service1]
;	No settings configured.

[Service2]
ConversionProhibited=TRUE
HomeServer=Exchange1
;       Required.
;	--  The name of the Microsoft Exchange Server the user should
;	connect to.  You can specify any Microsoft Exchange Server
;	in your site, and the correct Home Server will be assigned 
;	when the user first logs on.

[Service3]
Ben=TRUE
;	--  Dummy property.  Do not delete or modify.

[Service4]
PathToPersonalFolders=c:\outlook.pst
; The directories in the path to the personal folders must already exist

[Service5]
AccountName=PopAccount
' The AccountName has to match the Account name in Section 5.
LongAccountName=Internet E-mail - PopAccount
; The LongAccountName always has to be "Internet E-mail -" + <space> + AccountName

; ************************************************************************
; Section 5 - Values for each internet account.
; *******************************************************************
; The settings for each account that will be created. The available
; account settings are listed in Section 3, below.

[Account1]
; This is an example of a POP3 account
AccountName=PopAccount
ConnectionType=1
POP3Server=MyPOPServer
SMTPDisplayName=Someone
SMTPEmailAddress=someone@microsoft.com
SMTPOrgName=Personal
SMTPServer=MySMTPServer

; ************************************************************************
; Section 6 - Mapping for profile properties.  DO NOT MODIFY.
; ************************************************************************

; ************************************************************************
; Outlook settings stored in the profile
[Microsoft Outlook Client]
SectionGUID=0a0d020000000000c000000000000046

FormDirectoryPage=PT_STRING8,0x0270
;	-- The URL of Exchange Web Services Form Directory page used to
;	create Web forms.

WebServicesLocation=PT_STRING8,0x0271
;	-- The URL of Exchange Web Services page used to display
;	unknown forms.

ComposeWithWebServices=PT_BOOLEAN,0x0272
;	-- Set to TRUE to use Exchange Web Services to compose forms.

PromptWhenUsingWebServices=PT_BOOLEAN,0x0273
;	-- Set to TRUE to use Exchange Web Services to display unknown
;	forms.

OpenWithWebServices=PT_BOOLEAN,0x0274
;	-- Set to TRUE to prompt user before opening unknown forms when
;	using Exchange Web Services.

; ************************************************************************
; Microsoft Exchange Server service definitions.
[Microsoft Exchange Server]
ServiceName=MSEMS
MDBGUID=5494A1C0297F101BA58708002B2A2517

MailboxName=PT_STRING8,0x6607
;	-- The name of the user's Exchange Server Mailbox

HomeServer=PT_STRING8,0x6608
;	-- The name of the Microsoft Exchange Server the user should
;	connect to.  You can specify any Microsoft Exchange Server
;	in your site, and the correct Home Server will be assigned 
;	when the user first logs on.

OfflineFolderPath=PT_STRING8,0x6610
;       -- The path to the Offline Store File that contains
;       local replicas of the user's Mailbox and Favorites.
;       If you do not specify a value, no Offline Store will
;       be created.  If you specify a path, an Offline Store
;       will be created and the Inbox, Outbox, Deleted Items,
;       and Sent Items folders will be replicated to it.

OfflineAddressBookPath=PT_STRING8,0x660E
;	-- The path to the directory to store offline address
;	book files in.

ExchangeConfigFlags=PT_LONG,0x6601
;       -- Behavior when connecting to the Exchange Server.
;	32 - Auto detect online/offline connection state (default)
;	48 - Always connect online
;	50 - Prompt user for online or offline connection

ConversionProhibited=PT_BOOLEAN,0x3A03
;       -- A boolean value indicating whether NEWPROF should
;       attempt to resolve the Exchange mailbox name at run time. 
;       If set to TRUE, NEWPROF will copy the name to the profile
;       without resolving it.
;       If FALSE, the name will be resolved. Invalid server or 
;       mailbox name will not be copied to the profile.

; ************************************************************************
; Microsoft Mail service definitions.
[Microsoft Mail]
ServiceName=MSFS

ServerPath=PT_STRING8,0x6600
;      --  The path to the users post office.  Mapped network drives, UNC and NETWARE paths
;          are acceptable.  NETWARE paths of the type NWServer/share:dir\dir1 are converted to 
;          UNC paths of the type \\NWServer\share\dir\dir1. 

Mailbox=PT_STRING8,0x6601
;      --  The users mailbox name.  eg. in a NET/PO/USER address,
;          this is USER.  The maximum mailbox name is 10 characters.

Password=PT_STRING8,0x67f0
;      --  The users mailbox password.  The maximum password is 8 characters.

RememberPassword=PT_BOOLEAN,0x6606
;      --  A boolean value indicating whether the users password is
;          to be remembered in the profile or not.  This is useful because
;          if the password is remembered the user can bypass the logon prompt
;          if his server path, mailbox name and password are all supplied.

ConnectionType=PT_LONG,0x6603
;      --  The connection type.  This may be one of CFG_CONN_AUTO, CFG_CONN_LAN,
;          CFG_CONN_REMOTE, CFG_CONN_OFFLINE as defined below.
;
;          0x0         --  LAN type connection.  Used to connect to the post office using a
;                          UNC path or pre-existing mapped drive.
;          0x1         --  Dial up connection using Dial-up Networking.
;          0x2         --  Not connected.
;          0x3         --  Automatically detect whether the connection type is LAN or REMOTE.
;                          This connection type is only available on Win95.

UseSessionLog=PT_BOOLEAN,0x6604
;      --  A boolean value indicating whether session logging
;          is on or off.

SessionLogPath=PT_STRING8,0x6605
;      --  The path to the session log file.

EnableUpload=PT_BOOLEAN,0x6620
;      --  A boolean value which indicates whether mail in the outbox
;          is sent.

EnableDownload=PT_BOOLEAN,0x6621
;      --  A boolean value which indicates whether mail in the server
;          mailbag is downloaded.

UploadMask=PT_LONG,0x6622
;      --  A bit array which allows the user to indicate which addresses
;          for which the transport is to attempt delivery.  This is useful
;          in order to allow a user to specify that a transport only handle
;          delivery for a subset of the addresses it can really process.
;          When multiple transports are installed and the user wants a
;          different transport to handle some specific address types they
;          can use this bit array to specify that the MSMAIL transport
;          only handle a specific set of addresses.
;
;          Possible values as defined below include:
;
;          0x00000001      --  Local Post Office and External Post Office address types
;          0x00000002      --  PROFS address types
;          0x00000004      --  SNADS address types
;          0x00000008      --  MCI address types
;          0x00000010      --  X.400 address types
;          0x00000040      --  FAX address types
;          0x00000080      --  MHS address types
;          0x00000100      --  SMTP address types
;          0x00000800      --  OfficeVision address types
;          0x00001000      --  MacMail address types
;          0x000019df      --  All of the above address types

NetBiosNotification=PT_BOOLEAN,0x6623
;      --  A boolean value which indicates whether a netbios notification
;          is sent to a recipients transport when mail is delivered to
;          their server inbox.

NewMailPollInterval=PT_STRING8,0x6624
;      --  The polling interval in minutes when the transport
;          checks for new mail.  1 <= polling interval <= 9999

DisplayGalOnly=PT_BOOLEAN,0x6625
;      --  A boolean value which, if TRUE, only displays the Microsoft Mail Global Address
;          list for name selection.  The Postoffice list, external post office lists, and gateway
;          address lists are not shown.

UseHeadersOnLAN=PT_BOOLEAN,0x6630
;      --  A boolean value which indicates whether the user wants to enable
;          headers while working on the LAN.  Headers mode allows the user
;          to download message headers and selectively choose which mail
;          to download.

UseLocalAdressBookOnLAN=PT_BOOLEAN,0x6631
;      --  A boolean value which indicates whether the user wants to use
;          name resolution based on a local copy of the server address book
;          rather than the server address book itself.

UseExternalToHelpDeliverOnLAN=PT_BOOLEAN,0x6632
;      --  A boolean value which indicates whether EXTERNAL.EXE, a server process, should be used
;          to deliver submitted mail messages.  This is sometimes useful when mail is running 
;          on a slow LAN connection.

UseHeadersOnRAS=PT_BOOLEAN,0x6640
;      --  A boolean value which indicates whether the user wants to enable
;          headers while working over a slow speed link.  Headers mode
;          allows the user to download message headers and selectively
;          choose which mail to download.

UseLocalAdressBookOnRAS=PT_BOOLEAN,0x6641
;      --  A boolean value which indicates whether the user wants to use
;          name resolution based on a local copy of the server address book
;          rather than the server address book itself.

UseExternalToHelpDeliverOnRAS=PT_BOOLEAN,0x6639
;      --  A boolean value which indicates whether EXTERNAL.EXE, a server process, should be used
;          to deliver submitted mail messages.  This speeds up message delivery when mail is
;          running on a Dial-up network connection.

ConnectOnStartup=PT_BOOLEAN,0x6642
;      --  A boolean value which indicates that a Dial-up Network connection should
;          be established when the transport provider starts up.

DisconnectAfterRetrieveHeaders=PT_BOOLEAN,0x6643
;      --  A boolean value which indicates that a Dial-up Network connection should
;          be automatically terminated when headers are finished downloading.

DisconnectAfterRetrieveMail=PT_BOOLEAN,0x6644
;      --  A boolean value which indicates that a Dial-up Network connection should
;          be automatically terminated after mail has finished being sent
;          received.

DisconnectOnExit=PT_BOOLEAN,0x6645
;      --  A boolean value which indicates that a Dial-up Network connection should
;          be automatically terminated when the provider is exited.

DefaultDialupConnectionName=PT_STRING8,0x6646
;      --  The name of the Dial-up Network profile that the transport will use by
;          default to attempt the connection.

DialupRetryCount=PT_STRING8,0x6648
;      --  Number of times to attempt dial for connection.
;          1 <= retry attempts <= 9999

DialupRetryDelay=PT_STRING8,0x6649
;      --  Delay between retry attempts in seconds.
;          30 <= retry delay <= 9999

; ************************************************************************
; Personal Folders service definitions.

[Personal Folders]
ServiceName=MSPST MS

PathToPersonalFolders=PT_STRING8,0x6700 
;      --  Path to personal folders.

RememberPassword=PT_BOOLEAN,0x6701
;      --  A boolean value that determines if the personal folders password
;          should be cached.

EncryptionType=PT_LONG,0x6702
;      --  A value that designates the type of encryption that is used to
;          compress the data in the PST:
;
;          No Encryption              0x80000000
;          Compressable Encryption    0x40000000
;          Best Encryption            0x20000000

Password=PT_STRING8,0x6703
;      --  PST password.

; ************************************************************************
; Outlook Address Book service definitions.

[Outlook Address Book]
ServiceName=CONTAB
Ben=PT_STRING8,0x6700
;      --  Dummy property.  Do not modify.

; ************************************************************************
; Microsoft LDAP Directory service definitions.
[Microsoft LDAP Directory]
ServiceName=EMABLT

LDAPServer=PT_STRING8,0x6600
;	-- This is the IP address or host name of the machine containing
;	the LDAP server.

LDAPServerPort=PT_STRING8,0x6601
;	-- The port number that the LDAP server is listening on.

UserName=PT_STRING8,0x6602
; 	-- Enter the user's name. This value is not required if you allow
;	anonymous binds.

SearchBase=PT_STRING8,0x6603
;	-- The Search Base (e.g. o=microsoft, c=US).

SearchFilter=PT_STRING8,0x6604
;	-- The Search Filter in RFC1777 format with %s allowed as a
;	substitution token for the name to be searched for. For example,
;	(|(cn=*%s*)(sn=*%s*)) can be used to perform a search on common name
;	or surname.

MAPIAddressType=PT_STRING8,0x6605
;	-- The address type to be used by MAPI in message submission. For
;	example, SMTP.

EMailAttribute=PT_STRING8,0x6606
;	-- The E-Mail Attribute (e.g. mail, mhsOrAddresses or
;	rfc822Mailbox), which is mapped to the MAPI PR_EMAIL_ADDRESS property.

LDAPTimeLimit=PT_STRING8,0x6607
;	-- LDAP Time Limit for searching (in seconds). The maximum length of
;	time to search the directory. A value of 0 means that the search will
;	not be limited by time. Note that this will not necessarily supersede
;	any system-wide limits defined on the server.

LDAPSizeLimit=PT_STRING8,0x6608
;	-- LDAP Size limit for searching (in number of 'hits'). The maximum
;	number of matches to return. A value of 0 means that there is no
;	limit to the number of matches. Note that this will not necessarily
;	supersede any system-wide limits defined on the server.

LDAPTimeLimitLowBand=PT_STRING8,0x6609
;	-- Same as LDAP Time Limit, except for low bandwidth links.

LDAPSizeLimitLowBand=PT_STRING8,0x660a
;	-- Same as LDAP Size Limit, except for low bandwidth links.

LogFilePath=PT_STRING8,0x660b
;	-- Log File (full pathname).

ErrorLogging=PT_STRING8,0x660c
;	-- Error Logging Levels , ON or OFF.

DisplayNameSource=PT_STRING8,0x6611
;	-- Attribute to be used within the Internet Directory entry for
;	populating the user Display Name.

DisplayFailDialog=PT_STRING8,0x6612
;	-- Attribute to determine if a dialog will be displayed when a search
;	to the Internet Directory fails. The dialog will display additional
;	information. Values can be either 1 (display) or 0 (do not display).

[Internet E-Mail]
; If you configure an Internet E-mail service, then you also need to add
; information in section 5.

ServiceName=IMAIL
; When creating an Internet E-Mail service, both AccountName and
; LongAccountName MUST BE specified!

AccountName=PT_STRING8,0x661f
; This should be exactly the same as the I_Mail AccountName
; property.

LongAccountName=PT_STRING8,0x3001
; This should be the "Internet E-mail - " + the AccountName
; property. For example, if AccountName="foo", then this
; should be "Internet E-mail - foo".

; ************************************************************************
; Section 7 - Mapping for internet account properties.  DO NOT MODIFY.
; ************************************************************************

; Internet E-Mail service Settings/Definitions
; In a Corporate or Workgroup configuration, the only type of account that
; can be created is an I_MAIL (POP3) account. You can use settings from 
; the [I_Mail] section below.
; 

[I_Mail]
; *****************************
; *** Mail Account Settings ***
; *****************************
; Configurable settings for POP3 (Corporate and Intenet Only configs)
; and IMAP (Internet Only config only) mail accounts

AccountName=PT_STRING8,0x1235
; The name of the account that appears in the Account List.

ConnectionType=PT_DWORD,0x1239
; Values:
; 0 = Connect using local area network (LAN).
; 1 = Connect using Internet Explorer's or a 3rd party dialer.
; 2 = Connect using modem and the Dial-up Networking connection
;       specified in the Connectoid property.

Connectoid=PT_STRING8,0x123A
; Specify the existing Dial-up Networking connection to use.

; -----------------------------
; --- POP3 Account Settings ---
; -----------------------------

POP3Server=PT_STRING8,0x13C4
; Specifies the name of the POP3 server used for incoming messages.

POP3UseSicily=PT_BOOLEAN,0x13C8
; Set to 1 if you want to use Secure Password Authentication to logon
; to the POP3 server.

POP3LogonName=PT_STRING8,0x13C5
; If POP3UseSicily is turned on, this sets the name used to logon
; to the POP3 server.

POP3Port=PT_DWORD,0x13C9
; Specfies the port number used to connect to the POP3 server.

POP3SSL=PT_BOOLEAN,0x13CA
; Set to 1 to use the SSL (Secure Sockets Layer) security protocal to
; connect to the POP3 server.

POP3TimeOut=PT_DWORD,0x13CB
; Specifies how long to wait for a response for the server before
; stopping to attempt to send or receive messages. Possible values:
; 30 = 30 seconds
; 60 = 1 minute
; 90 = 1 minute 30 seconds
; 120 = 2 minutes
; 150 = 2 minutes 30 seconds
; 180 = 3 minutes
; 210 = 3 minutes 30 seconds
; 240 = 4 minutes
; 270 = 4 minutes 30 seconds
; 300 = 5 minutes

POP3LeaveOnServer=PT_BOOLEAN,0x13CC
; Set to 1 to store a copy of all sent and received messages on the
; POP3 server.

POP3RemoveExpired=PT_BOOLEAN,0x13CE
; If POP3LeaveOnServer is turned on, set to 1 to delete messages on
; the server after a specific number of days (see also
; POP3ExpireDays).

POP3ExpireDays=PT_DWORD,0x13CF
; If POP3LeaveOnServer and POP3RemoveExpired are turned on, sets
; the number of days after which messages left on the server will
; be deleted.

POP3RemoveDeleted=PT_BOOLEAN,0x13CD
; This property is only supported on Outlook 98 (8.5)or higher! If
; you try to use it on Outlook 97 (8.0x) the account will not be
; created.
; If POP3LeaveOnServer is turned on, set to 1 to delete a message
; from the server when the message is deleted from the Deleted
; Items folder on the local machine.

; -----------------------------
; --- SMTP Account Settings ---
; -----------------------------

SMTPServer=PT_STRING8,0x1428
; Specifies the name of the SMTP server used for outcoming messages.

SMTPUseSicily=PT_DWORD,0x142C
; Values:
; 0 = No server authentication required.
; 1 = Use Secure Password Authentication, or set SMTP server logon
;       name using SMTPLogonName.

SMTPLogonName=PT_STRING8,0x1429
; If SMTPUseSicily is set to 1, this sets the name used to logon to
; the SMTP server.

SMTPPort=PT_DWORD,0x142D
; Specfies the port number used to connect to the SMTP server.

SMTPSSL=PT_BOOLEAN,0x142E
; Set to 1 to use the SSL (Secure Sockets Layer) security protocal to
; connect to the SMTP server.

SMTPTimeOut=PT_DWORD,0x142F
; Specifies how long to wait for a response for the server before
; stopping to attempt to send or receive mail messages. Values are
;  the same as POP3TimeOut.

SMTPDisplayName=PT_STRING8,0x1430
; Specifies the "friendly" name associated with the email address.

SMTPOrgName=PT_STRING8,0x1431
; Specifies the group or organization.

SMTPEmailAddress=PT_STRING8,0x1432
; Specifies the email address. Must be in the format name@company

SMTPReplyAddress=PT_STRING8,0x1433
; Specifies that replies to outgoing email should be sent to this
; email address.

SMTPSplitMessages=PT_BOOLEAN,0x1434
; This property is only supported on Outlook 98 (8.5) or higher! If
; you try to use it on Outlook 97 (8.0x) the account will not be
; created.
; Set to 1 to break up outgoing messages, so that each message is
; smaller than the file size indicated by SMTPSplitSize.

SMTPSplitSize=PT_DWORD,0x1435
; The maximum size, in KB, of a piece of a split message.

 


i know this script works. there are hundreds of people using it. why can't i seem to get it to work?


Björn
(Korg Regular)
2006-12-12 04:28 PM
Re: Help with outlook script

I'd say the same as Jooel, you've only got a part of the function.

NuclearKitten
(Fresh Scripter)
2006-12-12 04:35 PM
Re: Help with outlook script

i went back to the original script. the only thing i changed is the servername. but still not working...

it's got to be something simple...something i'm over looking. but i'm just pulling my hair out here. i could have just configured all the clients by hand by now...but i'd like to learn to use the script anyway.


Mart
(KiX Supporter)
2006-12-12 05:19 PM
Re: Help with outlook script

Maybe I just don’t get it but why all these big scripts for outlook config?

All I do is create one (or more if you have some kind of custom settings per department or site) default PRF file and set the registry as shown below to tell outlook to use the prf specified.

http://office.microsoft.com/en-gb/help/HA011364251033.aspx

Quote:

....
Configuring Outlook user profiles by using a PRF file
You can use a PRF file in several ways to update Outlook 2002 profiles:

Import the PRF file in the Custom Installation Wizard or Custom Maintenance Wizard to specify profile settings in a transform, and then include the transform when you deploy or update Outlook.
Specify the PRF file as a command-line option for Outlook.exe. For example:
outlook.exe /importprf
\\server1\share\outlook.prf
Launch the PRF file directly on users' computers by double-clicking the file.
Configure the registry to trigger Outlook to import the PRF file when Outlook starts up. You can use the Add/Remove Registry Entries page in Custom Installation Wizard or the Custom Maintenance Wizard to deploy these registry key options to your users. You can also use the wizards to distribute the PRF file to users by using the Add/Remove Files page.
Delete the following registry key value : HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Setup\First-Run.
In the HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Setup subkey, set the value of ImportPRF to a string value that specifies the name and path of the PRF file. For example, set ImportPRF to \\server1\share\outlook.prf.


JochenAdministrator
(KiX Supporter)
2006-12-12 05:48 PM
Re: Help with outlook script

Welcome NK,

the 'script' you posted in the first post is far away from being executable. Even if the function OUTLOOK() (most probably written functional by Kent) was posted completely (proper closing endselect, endif AND endfunction), it would do nothing as there is NOTHING in it that uses the function. So either you haven't posted your script completely for whatever reason there might be OR you haven't understood the concept of using UDFs.

Please make clear how we can be of help.
Thanx

J.


NuclearKitten
(Fresh Scripter)
2006-12-12 06:12 PM
Re: Help with outlook script

maybe it is that i don't understand UDF's. maybe you could help pwith that?
thanks, joschen. here is the complete script:

Code:
FUNCTION OUTLOOK()
     DIM $prfrem,$waste,$explorview,$editorpref,$prf,$serverloc,
    $exchgsvr,$prfloc,$prffile,$ppru,$exe,$ver,$idx,$keyname,$rc,
    $outlook,$ns,$unread,$fldr,$x,$regexp,$MSOdir

    $waste='FALSE'    ; 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='Outlook.prf'
    $prffile='%temp%\'+$prf
    $serverloc=@LSERVER+'\Netlogon\Profgen' ; Outlook Executables files location
    $exchgsvr='EXCHANGE1'     ; Main Exchange Server Location
    IF @INWIN ;Windows NT/2k/XP/2003
       $prfloc='HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
    ELSE
       ;Windows 9x
       $prfloc='HKCU\Software\Microsoft\Windows Messaging Subsystem\Profiles'
    ENDIF
    ; -- Current User Profile
    $ppru=$prfloc+'\'+@USERID

    ; -- Determine version of Outlook
    $exe=ReadValue('HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE','')
    $ver=SPLIT(GetFileVersion($exe),'.')[0]+'.0'
    $MSOdir=SUBSTR($exe,1,Len($exe)-11)

    ; -- This is used for when you have people come into the company from another Exchange Server into yours
    IF INGROUP('GROUPNAME') AND READVALUE($ppru+'\13dbb0c8aa05101a9bb000aa002fc45a','001e6602')<>$exchgsvr
       $rc=WriteValue($ppru+'\13dbb0c8aa05101a9bb000aa002fc45a','001e6602',$exchgsvr,'REG_SZ')
       $rc=WriteValue($ppru+'\13dbb0c8aa05101a9bb000aa002fc45a','001e6608',$exchgsvr,'REG_SZ')
    ENDIF

    ; -- Look for Outlook Profile
    ;IF ReadValue($prfloc,'DefaultProfile')<>@USERID AND ReadValue($prfloc,'DefaultProfile')<>'MS Exchange Settings' OR @ERROR
    IF (ReadValue($prfloc,'DefaultProfile')<>@USERID AND NOT INSTR(ReadValue($prfloc,'DefaultProfile'),'MS Exchange')) OR @ERROR
       COPY $serverloc+'\'+$prf $prffile
       $rc=WriteProfileString($prffile,'General','ProfileName',@USERID)
       $rc=WriteProfileString($prffile,'General','DefaultProfile','Yes')
       $rc=WriteProfileString($prffile,'General','OverwriteProfile','Yes')
       $rc=WriteProfileString($prffile,'General','BackupProfile','No')
       $rc=WriteProfileString($prffile,'Service1','AutoNameCheck','TRUE')
       $rc=WriteProfileString($prffile,'Service1','EmptyWastebasket',$waste)
       $rc=WriteProfileString($prffile,'Service1','CloseOriginalMessage','TRUE')
       $rc=WriteProfileString($prffile,'Service2','HomeServer',$exchgsvr)
       $rc=WriteProfileString($prffile,'Service2','MailboxName',@USERID)

       SELECT
       CASE
          $ver='8.0' OR $ver='9.0' ;(e.g. 8.5.5104.0)
          SHELL '%COMSPEC% /C '+$serverloc+'\newprof.exe -p '+$prffile+' -x'
          $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook','Machine Name',@WKSTA,'REG_SZ')
          $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook','CheckInternetAccounts',1,'REG_DWORD')
          $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook','FirstRunDialog','False','REG_SZ')
          $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','PrimaryClient',1,'REG_DWORD')
          $rc=WriteValue('HKLM\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','MailSupport',1,'REG_DWORD')
          $rc=WriteValue('HKLM\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','First-Run','df83b12adc9cd511b57c0002a57ce19c','REG_BINARY')
          IF $explorview='Yes'
             $rc=WriteValue($prfloc+@userid+'\0a0d020000000000c000000000000046','001e0360','','REG_SZ')
             $expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff62000000270000003'
             $expview=$expview+'c030000ac02000001000000000000000100000000000000c00000006400000003000000'
             $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY')
          ENDIF
       CASE
          $ver='10.0' OR $ver='11.0'  OR $ver='12.0';(e.g. 10.0.2627.1)
          $rc=DelValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','First-Run')
          $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\Setup','ImportPRF',$prffile,'REG_SZ')
          IF $ver='10.0'
             $rc=WriteValue('HKCU\Software\Microsoft\Office\'+$ver+'\Outlook\IM','Enabled',0,'REG_DWORD')
          ENDIF
          ; -- This was added as we needed to generate Outlook Profiles in a Citrix Session - thanks Rad!
          $outlook=CreateObject('Outlook.Application')
          $ns=$outlook.getnamespace('MAPI')
          $fldr=$ns.getdefaultfolder(6)
          $unread=$fldr.unreaditemcount
          $outlook=0
       ENDSELECT
       DEL $MSOdir+'welcome.msg'
    ENDIF
 ENDFUNCTION
 


NuclearKitten
(Fresh Scripter)
2006-12-12 10:17 PM
Re: Help with outlook script

ok - i wasn't aware of the fact that UDF's were to be called from a kix scripts. i'm tring to figure out how to call them and i found the FAQ. however, i'm having a hard time making sense of it.

i saved the kyder script as outlook.udf

how would i execute it from my other script? i tried following the faq - but it's just not making sense. my head is totally fried at this point. i've got the script in the netlogon share alond with the UDF, but the UDF wont execute.
Code:
break on
;placing the CALL here works
call @lserver + 'Netlogon\outlook.udf'
get $_
Exit 1
 


could someone please hold my hand through this? i feel like a total moron.


LonkeroAdministrator
(KiX Master Guru)
2006-12-12 10:25 PM
Re: Help with outlook script

with the call line you just inject the udf source to your script during runtime.
to execute the udf, you need to add anywhere in your script after that injection a simple line of:
Code:
outlook()


to explain a little further, UDF is just a function declaration. it says what is the name of the function and it's parameters and what to do when it's called.
when you have defined it, you can use it the same as any kixtart internal function, like readvalue()
the only difference is that readvalue() is already declared inside the kixtart executable and UDF is something you define/declare yourself.


NuclearKitten
(Fresh Scripter)
2006-12-12 10:29 PM
Re: Help with outlook script

like this?
Code:
break on
;placing the CALL here works
call @lserver + 'Netlogon\outlook.udf'
outlook()
get $_
Exit 1

 


NuclearKitten
(Fresh Scripter)
2006-12-12 10:32 PM
Re: Help with outlook script

Originally Posted By: Jooel
with the call line you just inject the udf source to your script during runtime.
to execute the udf, you need to add anywhere in your script after that injection a simple line of:
Code:
outlook()


to explain a little further, UDF is just a function declaration. it says what is the name of the function and it's parameters and what to do when it's called.
when you have defined it, you can use it the same as any kixtart internal function, like readvalue()
the only difference is that readvalue() is already declared inside the kixtart executable and UDF is something you define/declare yourself.


oh..i think i see what you are saying. so it would be like this?
Code:
break on
;placing the CALL here works
call @lserver + 'Netlogon\outlook.udf'
get $_
Exit 1
outlook()
 


the call loads the function, then the outlook() actually executes it?


Les
(KiX Master)
2006-12-12 10:51 PM
Re: Help with outlook script

No, the script hits exit before that and goes bye-bye.

NuclearKitten
(Fresh Scripter)
2006-12-12 10:56 PM
Re: Help with outlook script

Originally Posted By: Les
No, the script hits exit before that and goes bye-bye.


lol...oops. that was stupid. that's about the level of my mental faculties right now.


LonkeroAdministrator
(KiX Master Guru)
2006-12-12 11:02 PM
Re: Help with outlook script

so, your original try at it would have worked fine.

just to mess with your mind, you have other options than just call.
you could use include instead.
include loads the file before execution, so it doesn't matter in which part of the script you use it.
also, included UDF files do really get included and if you use tokenize, they are inbuilt with the tokenized script, so need for separate files.

or you could use the simple way of just pasting the udf at the bottom of your script file. that way you don't need to care about additional files at all. on the other hand, if your script grows, it might get a bit hard to find anything in the script, so it can be a downside as well.


NuclearKitten
(Fresh Scripter)
2006-12-12 11:02 PM
Re: Help with outlook script

Originally Posted By: Les
No, the script hits exit before that and goes bye-bye.


hrm...this is what i have now, but it still doesn't seem to execute the outlook function.
Code:
 
break on

call @scriptdir + '\outlook.udf'

outlook()


i've had enough for today. i'll try again in the morning when i can get a fresh start...


Glenn BarnasAdministrator
(KiX Supporter)
2006-12-13 01:42 AM
Re: Help with outlook script

You could use KGen, which makes using UDFs transparent to the development process.

With KGen, you would write a TEST.TXT file in a project folder somewhere, like this:
Code:
break on

$RC = Outlook()

"The Outlook udf returned " $RC ?


Next, in the folder where your TEST.TXT file is, run KGEN TEST

(This assumes you placed KGEN.bat in the \Windows folder, or some folder in your PATH, and edited it to point to the location of the KiX32.exe and KGen.kix files, and defined the KixLibPath environment variable to point to a folder with all your common UDF files in it)

After a few seconds (and a warning that Variable $RC was not declared), you will find a TEST.KIX file in the directory, with the Outlook UDF included in it. Simply execute your TEST.KIX and verify it works!

KGen works like a Link-Editor for KiXtart. It enumerates every .UDF file in each directory specified by the KixLibPath variable. It creates an index of which UDF is in which file. It then parses your script TXT file (along with any .UDF files in the same folder) and assembles the .TXT file, all .UDF files from the current folder, and any .UDF file in your lib folder(s) needed by your script. It does so reiteratively, so that any dependencies of one UDF on another are resolved. By including all the .UDF files from the current folder, you can break larger projects into smaller, more managable parts, and still keep them all in one place.

Some other benefits of KGEN:
  • Automatically performs a Sanity check of your code, looking for mismatched quotes or parens
  • Identifies undeclared vars, duplicate var declarations, vars declared both local and global, and vars declared but not used
  • Writes a log of all the UDF files it used to complete your project
  • Creates a report (and INI file) of every var used, what line it was declared on, and what function it was declared in

KGen can be downloaded from my web site - it is the KiXDev package.

Glenn

PS - the next release of KGen (due in late Jan 07) will also create a .HTM file when the script is generated. This colorized image will help you quickly spot problems, and can be posted directly to the KORG BBS.


NuclearKitten
(Fresh Scripter)
2006-12-13 03:23 AM
Re: Help with outlook script

hey glen! thanks a ton! this looks super cool! i'll take a look as soon as i make it to the office in the morning.
that is so cool that your company develops those tools, then offers them to fellow admins. wow - things like that, and this site are such a huge help to people. i've always found it kinda cool how IT guys are so willing to share knowledge and help each other out. keep up the good work!


NuclearKitten
(Fresh Scripter)
2006-12-13 06:23 PM
Re: Help with outlook script

glenn - i gotta hand it to you man, that is a neat little utility! the script works perfectly now.

LonkeroAdministrator
(KiX Master Guru)
2006-12-13 06:28 PM
Re: Help with outlook script

and what was the issue?

NuclearKitten
(Fresh Scripter)
2006-12-13 07:34 PM
Re: Help with outlook script

Originally Posted By: Jooel
and what was the issue?


i don't know how to properly use a udf, lol.


NuclearKitten
(Fresh Scripter)
2006-12-13 07:35 PM
Re: Help with outlook script

i also found a couple of misspellings in the prf...that may have been the problem all along.

Glenn BarnasAdministrator
(KiX Supporter)
2006-12-13 07:36 PM
Re: Help with outlook script

Cool!

I'd appreciate any feedback on the tool, docs, etc, either via email or a PM here on KORG.

Glenn