问题描述
我正在尝试创建计划任务以在 Windows Server 2012 R2 中执行 powershell 脚本.通过执行 powershell 脚本,我想获取登录事件并将其存储在文件中.当我触发任务时,powershell 脚本正在执行并创建将存储信息的文件,但它无法从事件日志中获取登录信息.
I am trying to create a scheduled task to execute a powershell script in Windows Server 2012 R2. By executing the powershell script, I want to get the log in events and store it in a file.When I trigger the task, the powershell script is executing and creating the file which will store the information but it is not able to fetch the login information from event logs.
当我尝试以管理员身份运行任务时,一切正常.
When I try to run the task as Administrator, everything works fine.
那么,如果我创建了要从 Windows 本地服务帐户执行的计划任务,我是否需要设置任何额外的权限以在 powershell 脚本中获取登录信息?
So, do I need to set any extra permission to fetch log-in information in powershell script, if I create the scheduled task to be executed from Windows Local Service account?
提前致谢.
推荐答案
是的,请确保您以管理员身份运行,否则通过管理员帐户在您的计算机上创建任务.大多数任务需要管理员权限才能运行,为此您可以通过管理员创建该任务并添加选项无论用户是否登录都运行".
Yes make sure you're running as administrator or else create the task via the administrator account to your computer. most of the task require the administrator permission to run, for that you can create that that task via admin and add the option "Run whether the user is logged in or not".
这篇关于无法从本地服务帐户在 Windows Server 2012 R2 中运行计划任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!