Powershell“启动进程"未按计划任务运行 [英] Powershell "Start-process" not running as scheduled task
问题描述
有两个我从 XP 编辑的 powershell 脚本,以便在 Win Server 2k8 R2 中运行.
Have two powershell scripts that I edited from XP to run in Win Server 2k8 R2.
在 powershell 中手动执行时它们运行良好,但如果计划并以域管理员身份运行,它们将执行它们应该执行的所有文件操作;除非他们不执行将文件发送到需要访问的 SFTP 站点的启动过程.
They run fine when executed by manually in powershell, but if scheduled and run as domain admin, they perform all file operations they're supposed to; except they don't do a start-process that sends the file to the SFTP site it needs to go to.
它们是通过运行带有如下参数的 powershell.exe 来启动的:
They're launched by running powershell.exe with arguments as such:
-noprofile -ExecutionPolicy Bypass -file C:\Users\administrator\Documents\script1.ps1
同样,就像我之前提到的,如果您手动运行它们,它们会运行良好并按要求启动 start-process
,并且仅在计划的情况下运行文件操作并跳过启动过程.
Again, like I mentioned previously, they run fine and launch the start-process
as requested if you manually run them and only run the file operations if they're scheduled and skip the start-process.
start-process
如下:
start-process -FilePath "c:\Program Files (x86)\Tumbleweed\STClient\stclient.exe" -ArgumentList "httpsu://www.securesiteexample.org/incoming/ $filename /prefNoAskSched /hidden /log /Remote-Site return /quitWhenDone"
我错过了什么?
推荐答案
在您的任务中,转到 操作 窗格,编辑并删除 start in 字段中的任何内容.
In your Task, go to Actions pane, edit and remove anything from start in field.
这篇关于Powershell“启动进程"未按计划任务运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!