none
Powershell - Configure Outlook with prf file. RRS feed

  • Question

  • Hi,

    I am trying to start outlook application configured with my .prf file in powershell. 

    My question is, how can I start outlook application by passing .prf file in powershell.

    I am using below code to start outlook application - 

    $outlook = New-Object -Com Outlook.Application

    Thanks,


    • Edited by dvcoder Wednesday, February 26, 2014 9:42 PM
    Wednesday, February 26, 2014 9:03 PM

Answers

  • Hi,

    According to your description, I think you just want to use a PowerShell code to start the Outlook.exe and import a new prf file to configure it at the same time.

    In fact, we could run a cmd command as “outlook.exe /importprf c:\Outlookprf.prf” to start Outlook application with a new “Outlookprf.prf” file manually.

    To do that with PowerShell, you could refer to the code below.

    Start-Process "C:\Program Files (x86)\Microsoft Office\Office12\Outlook.exe" -ArgumentList "/importprf c:\scripts$\Outlook2007mapi.prf" –WindowStyle

    By the way, for more question about starting applications with PowerShell, you could consider posting in Windows PowerShell forums for more effective responses.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by dvcoder Thursday, February 27, 2014 5:58 PM
    Thursday, February 27, 2014 9:30 AM
    Moderator

All replies

  • Hi dvcoder,

    Your code looks good.

    It looks like your question is related to PowerShell, not Outlook. That's why I'd suggest asking such questions in the PowerShell forums instead.


    Wednesday, February 26, 2014 9:15 PM
  • Are you trying to create a brand new profile and start Outlook in that profile?

    What will the profile contain? Does it need to be a new profile?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, February 26, 2014 9:27 PM
  • Yes, It's a new profile. 

    The .prf contains all the account information and everything.

    I just need to open the outlook with this .prf file.

    I am very new to powershell, any help would be much appreciated!

    Wednesday, February 26, 2014 10:21 PM
  • What I am getting at is, do you really need a new profile? What are you trying to do that you cannot do with an existing profile?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, February 27, 2014 12:32 AM
  • Yes, I need to use the new .prf file.
    Thursday, February 27, 2014 1:23 AM
  • Again, may I ask why? What will the new profile contain?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Thursday, February 27, 2014 1:55 AM
  • Hi,

    According to your description, I think you just want to use a PowerShell code to start the Outlook.exe and import a new prf file to configure it at the same time.

    In fact, we could run a cmd command as “outlook.exe /importprf c:\Outlookprf.prf” to start Outlook application with a new “Outlookprf.prf” file manually.

    To do that with PowerShell, you could refer to the code below.

    Start-Process "C:\Program Files (x86)\Microsoft Office\Office12\Outlook.exe" -ArgumentList "/importprf c:\scripts$\Outlook2007mapi.prf" –WindowStyle

    By the way, for more question about starting applications with PowerShell, you could consider posting in Windows PowerShell forums for more effective responses.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by dvcoder Thursday, February 27, 2014 5:58 PM
    Thursday, February 27, 2014 9:30 AM
    Moderator