Login Script to create Outlook Profile and run .exe file RRS feed

  • Question

  • I am trying to automate the login process for a new Citrix environment with a login script to create Outlook profile, then run a .exe file and some registry keys. The problem I am having is that the profile has to be created before running the .exe file (Addiman.exe) which creates a Data file in the users Outlook profile that is in C:\Program Files (x86)\Interwoven\WorkSite. 

    Unfortunately, I do not know how to write scripts, although I am looking to learn. Below is a VBScript I found that creates the profile, is there a way to add to it to run the addiman.exe after the profile is created? I also created a bat file and added it to the login scripts, but since the Profile needs to be created first, I login in the first timeand it creates the profile, but then I have to log out and back in for it to run the addiman.exe to create the data file in the Outlook profile. 

    Any assistance with this would be appreciated. 

    ' 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

    • Moved by Bill_Stewart Wednesday, February 14, 2018 7:41 PM This is not "scripts on demand"
    Tuesday, January 9, 2018 5:54 PM