用Task Scheduler定义执行一段Powershell脚本,用LocalSystem执行的,结果发现进程经常卡死。
后来发现可以使用 -noProfile 强制执行时候不依赖当前用户的profile,卡死的问题就解决了。
%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass .\Scripts\YourScript.ps1
本文链接: https://www.pstips.net/powershell-process-gets-stuck-when-under-localsystem-account.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!
这个有意思,怎么发现的。