Help with scripting login to create Outlook 2010 profile and then run an exe file after creation RRS feed

  • Question

  • Need a little scripting help, hope I am putting this in the right place. I had found a VBS script to create the Outlook 2010 profile  using a PRF file when the user logs in which works great. Problem I have now is we have upgraded to iManage filesite 9.3 which needs a data file created in the outlook profile. There is an EXE file in the program that will do this, so I created a BAT file to run this EXE and added it to the login script. The problem is, the profile has to be there for the EXE to create the Data file, when a new user logs in for the first time, it creates the profile but not the Filesite Data file. Then if they log out and log back in, it creates the data file. I figure there needs to be a pause between the profile creation or a check to see if the profile is created before running the EXE to create the data file, but I do not know how to do that. Below is the VBS file and BAT files. I am sure for someone who knows how to write scripts this is a pretty simple thing, unfortunately I am not one. Thanks in advance for the help on this.  

    ' Description: This script determines if a specified mail profile already exists.
    '              If it doesn't, it will set the path to the prf-file containing
    '              the mail profile configuration settings.
    ' author : Robert Sparnaaij
    ' version: 2.0
    ' website: http://www.howto-outlook.com/howto/deployprf.htm

    '=====BEGIN EDITING=====

    'Name of mail profile as in the prf-file
    ProfileName = "Outlook"

    'Path to the prf-file
    ProfilePath = "\\Rtlaw.com\sysvol\RTLAW.COM\New Scripts\OutlookProfile.prf"

    'Increase the ProfileVersion whenever you want to reapply the prf-file
    ProfileVersion = 1


    const HKEY_CURRENT_USER = &H80000001
    const HKEY_LOCAL_MACHINE = &H80000002

    strComputer = "."
    Set objRegistry = GetObject("winmgmts:\\" & _
        strComputer & "\root\default:StdRegProv")

    'Determine path to outlook.exe
    strKeyOutlookAppPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\OUTLOOK.EXE"
    strOutlookPath = "Path"
    objRegistry.GetStringValue _

    'Verify that the outlook.exe exist and get version information
    Set objFSO = CreateObject("Scripting.FileSystemObject") 
    If objFSO.FileExists(strOutlookPathValue & "outlook.exe") Then
        strOutlookVersionNumber = objFSO.GetFileVersion(strOutlookPathValue & "outlook.exe")
        strOutlookVersion = Left(strOutlookVersionNumber, inStr(strOutlookVersionNumber, ".0") - 1)
        Wscript.Echo "The location of OUTLOOK.EXE couldn not be verified." & vbNewLine & _
        "Please contact your system administrator."
    End If

    'Set profile Registry path based on Outlook version
    If strOutlookVersion >= 15 Then
        strKeyProfilePath = _ 
    "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\" & strOutlookVersion & ".0\Outlook\Profiles\" _ 
    & ProfileName & "\9375CFF0413111d3B88A00104B2A6676"
    strKeyProfilePath = _ 
    "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" _ 
    & ProfileName & "\9375CFF0413111d3B88A00104B2A6676"
        End If

    'Check if a mail profile already exists 
    strLastChangeVer = "LastChangeVer"
    objRegistry.GetBinaryValue _

    'Check if the prf-file needs to be reapplied
    If ProfileVersion > 1 Then
        strKeyProfileVersionPath = "SOFTWARE\HowTo-Outlook\DeployPRF"
        strProfileVersionName = ProfileName
        objRegistry.GetDWORDValue _

        If IsNull(strValueProfileVersion) OR ProfileVersion > strValueProfileVersion Then
    ReapplyPrf = True
        End If
    End If

    'Apply the prf-file if needed
    If IsNull(strValueLastChangeVer) OR ReapplyPrf Then
        'The mail profile doesn't exist yet so we'll set the the ImportPRF key and remove the FirstRun keys

        'Verify that the configured prf-file exist
        Set objFSO = CreateObject("Scripting.FileSystemObject") 
        If objFSO.FileExists(ProfilePath) Then

    'Create the Setup key, set the ImportPRF value and delete the First-Run values.
    strKeyOutlookSetupPath = "SOFTWARE\Microsoft\Office\" & strOutlookVersion & ".0\Outlook\Setup"

    strImportPRFValueName = "ImportPRF"
    strImportPRFValue = ProfilePath
    objRegistry.CreateKey HKEY_CURRENT_USER,strKeyOutlookSetupPath
    objRegistry.SetStringValue HKEY_CURRENT_USER,_

    strFirstRunValueName = "FirstRun"
    objRegistry.DeleteValue HKEY_CURRENT_USER,_

    strFirstRun2ValueName = "First-Run"
    objRegistry.DeleteValue HKEY_CURRENT_USER,_

    'Save the applied ProfileVersion if larger than 1.
    If ProfileVersion > 1 Then
        objRegistry.CreateKey HKEY_CURRENT_USER,strKeyProfileVersionPath
        objRegistry.SetDWORDValue HKEY_CURRENT_USER,_
    End If

            Wscript.Echo "Crucial file in script could not be found." & vbNewLine & _
            "Please contact your system administrator." 
        End If

        'The mail profile already exists so there is no need to launch Outlook with the profile switch.
        'Of course you are free to do something else here with the knowledge that the mail profile exists.
    End If

    Set objRegistry = Nothing
    Set objFSO = Nothing

    BAT File:

    cd C:\Program Files (x86)\Interwoven\WorkSite\
    addiman rtlaw-dms1

    • Moved by Bill_Stewart Monday, March 12, 2018 8:42 PM This is not "fix/debug/rewrite my script for me" forum
    Wednesday, January 24, 2018 6:15 PM

All replies

  • Outlook 2010 is no longer supported on Windows systems.  You need to upgrade.

    We do not "fix" scripts you have found on the Internet.  We can answer questions about scripts you are writing.

    This is not a free consulting forum. 

    Please read all of the following before posting:

    This Forum is for Scripting Question Rather than script requests

    Script Gallery.

    Learn PowerShell  

    Script requests


    Wednesday, January 24, 2018 6:20 PM
  • Else
        'The mail profile already exists so there is no need to launch Outlook with the profile switch.
        'Of course you are free to do something else here with the knowledge that the mail profile exists.
    End If
    this is where you would add the exe run. good luck buckaroo.
    Wednesday, January 24, 2018 6:37 PM