[英]Task Scheduler - Show Powershell Prompt
I Know how to schedule a Powershell script, but now I'm looking for a way to show what's happening.我知道如何安排 Powershell 脚本,但现在我正在寻找一种方法来显示正在发生的事情。 I Don't want to write the output to a log, but I want to have a prompt opened.
我不想将输出写入日志,但我想打开提示。 (Like running the .bat directly, without using the Task Schedular).
(就像直接运行 .bat,而不使用 Task Schedular)。
Google isn't helping me.谷歌没有帮助我。
Use the Run only when user is logged on
option, per the screenshot below.根据下面的屏幕截图,使用
Run only when user is logged on
选项。
This a late reply, but I wanted to share my experience.这是一个迟到的回复,但我想分享我的经验。
Use New-ScheduledTaskPrincipal
, with -LogonType Interactive
, the -RunLevel
if you need it, and the -UserId
to specify which user will run that task.使用
New-ScheduledTaskPrincipal
、 -LogonType Interactive
、 -RunLevel
如果需要)和-UserId
来指定哪个用户将运行该任务。
In addition, use New-ScheduledTaskTrigger
with the -AtLogon
parameter (if you want the PowerShell window to appear at logon) and set -User
to the same as -UserId
above.此外,使用带有
-AtLogon
参数的New-ScheduledTaskTrigger
(如果您希望 PowerShell 窗口在登录时出现)并将-User
设置为-UserId
上面的-UserId
相同。
When registering the principal with Register-ScheduledTask
, make sure not use the -User
, -Password
, and -RunLevel
parameters, as the syntax paragraph states they are not allowed.使用
Register-ScheduledTask
注册主体时,请确保不要使用-User
、 -Password
和-RunLevel
参数,因为语法段落指出它们是不允许的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.