英文:
Opening specific Outlook profile with Powershell
问题
当我在PowerShell中运行这个简单的脚本来打开Outlook时,它可以工作,但是当我想通过任务计划程序来运行它时,它不起作用。
脚本使用的是:
Start-Process -FilePath "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE"
我认为问题在于我使用一个帐户登录,而我的Outlook配置文件来自另一个帐户。我尝试更改任务计划程序中的用户或组,但这也导致了一个错误,说找不到该帐户。
如何设置我的PowerShell脚本,以确保我使用正确的配置文件打开Outlook?
英文:
When I run the simple script in PowerShell to open Outlook it works, but when I want to run it via the Task Scheduler it doesn't work.
Script used:
Start-Process -FilePath "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE"
I think the problem is that I login with one account and my Outlook profile is from a different account.
I tried to change the User or Group inside the Task Scheduler, but this also gives me an error that the account is not found.
How can I setup my PowerShell script to ensure I open Outlook with the correct profile?
答案1
得分: 1
$ProfileName = "Whatever"
Start-Process -FilePath "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE" -ArgumentList "/profile `"$ProfileName`""
这可能有效吗?
英文:
$ProfileName = "Whatever"
Start-Process -FilePath "C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE" -ArgumentList "/profile `"$ProfileName`""
This might work?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论