为什么我运行PS1脚本的计划任务没有终止?

时间:2020-03-09 11:29:40

标签: powershell scheduled-tasks windows-server-2016 taskmanager task-management

我有一个配置为由 Windows Server 2016 上的计划任务执行的Powershell脚本script.ps1,它可以执行工作,但不会终止。当任务管理器尝试再次启动任务以进行下一次预定运行时,这会导致问题。

该任务配置为启动powershell.exe,然后使用-Command启动脚本:

powershell -Command "& C:\Scripts\script.ps1"

该任务正在由具有管理员特权的域用户执行,并且配置为无论该帐户是否实际登录都可以运行。

1 个答案:

答案 0 :(得分:0)

当我没有配置ExecutionPolicy时遇到了同样的问题 您可以在这里了解更多信息:https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy

相关问题