任务计划程序不支持选项“以最高特权运行".和“运行天气用户是否登录". [英] Task Scheduler is not supporting option "Run with highest Privilege" and "Run weather user is logged on or not"

查看:193
本文介绍了任务计划程序不支持选项“以最高特权运行".和“运行天气用户是否登录".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Task Scheduler上安排Task,除非我勾选以最高特权运行"或是否登录了Run Weather用户",否则一切都会正常运行

I am trying to schedule Task on Task Scheduler, every thing is working fine unless I tick "Run with Highest privileges" or "Run weather user is logged on or not"

一旦我勾选了此选项,调度程序就会停止触发我的脚本.

As soon as I tick this, scheduler stop triggering my Script.

脚本-使用Power Shell命令的.Bat文件.

Script- .Bat file using Power Shell command.

任何人都可以找出问题出在哪里吗?

Can any one figure out what went wrong?

已编辑-(将文件位置从驱动器更改为网络驱动器)

Edited- ( Changed file location from drive to network drive)

@Echo Off

:: SDate=DAYMONTHYEAR FORMAT of Systemdate
::set SDate=%date:~7,2%%date:~4,2%%date:~10,4%

::Variable for folder path
for /D %%d in ("\\Server\Schd File\AA\*") do (
for %%a in ("%%d\*.*") do (SET "FPath=%%~dpa"
Set "FName=%%~na" )
)

For /F "Tokens=4-9 Delims=-" %%A In ("%FName%") Do (
    Set "Freq=%%B"
    Set "ADate=%%F%%E%%D"
)

Set "DFormat=ddMMyyyy"

IF %Freq% == Daily (
For /F UseBackQ %%A In (
    `Powershell "([datetime]::ParseExact('%ADate%','%DFormat%',[System.Globalization.CultureInfo]::CurrentCulture)).AddDays(-1).ToString('ddMMyyyy')"`
) Do Set "DateF=%%A"
)

IF %Freq% == Weekly ( 
For /F UseBackQ %%A In (
    `Powershell "([datetime]::ParseExact('%ADate%','%DFormat%', [System.Globalization.CultureInfo]::CurrentCulture)).AddDays(-7).ToString('ddMMyyyy')"`
) Do Set "DateF=%%A"
)

IF %Freq% == Monthly (
For /F UseBackQ %%A In (
    `Powershell "([datetime]::ParseExact('%ADate%','%DFormat%', [System.Globalization.CultureInfo]::CurrentCulture)).AddMonths(-1).ToString('MMMyyyy')"`
) Do Set "DateF=%%A"
)


mkdir "%FPath%%Freq%\%DateF%"
move "%FPath%\%FName%.*" "%FPath%%Freq%\%DateF%\"

GoTo :EOF

推荐答案

在Vista和更高版本中,对计划任务的安全性进行了重大改进,以防止黑客安装可以访问网络资源的计划任务.

There was a major overhaul of Scheduled Tasks security in Vista and later to prevent hackers from installing a scheduled task that could access network resources.

在将任务设置为运行(无论用户是否登录)时,必须将用户凭据设置为具有运行任务所需权限的用户.该用户还必须设置本地策略,以允许该用户运行批处理文件.

When you set the task to run whether or not a user is logged on you must set the user credentials to a user with the permissions needed to run the task. That user must also have the local policy set to allow the user to run batch files.

此外,当用户未登录时,任务计划程序将使用用户服务"(S4U)身份验证,该身份验证拒绝用户访问任何网络功能.假设您的"D:\ AA *"路径是本地驱动器,则可能不会有问题,但是如果它是映射的网络驱动器,则将有问题.

Additionally, when a user is not logged on, task scheduler uses "Service-for-User" (S4U) authentication which denies the user access to any network functionality. Assuming your "D:\AA*" path is a local drive this may not be a problem but if it is a mapped network drive it will be a problem.

以最高特权运行"不会向指定用户授予更高的特权,而是在安装Windows时创建的系统管理员帐户的完全独立的安全令牌下运行.

"Run with Highest privileges" does not grant higher privileges to the specified user but runs under a completely separate security token for the system Administrator account that is created when Windows is installed.

https://technet.microsoft. com/en-us/library/cc722152(v = ws.11).aspx

https://technet.microsoft. com/en-us/library/cc732613(v = ws.10).aspx

https://technet.microsoft. com/en-us/library/ee844140(v = ws.10).aspx

https://superuser.com/questions/640962/why-cant-a-task-scheduler-job-access-a-mapped-network-drive/782836#782836

我发现唯一需要通宵访问网络的任务的解决方案是让计算机保持运行状态,并让用户登录.

The only solution I found to run a task overnight that needs network access was to leave the machine running and the user logged on.

这篇关于任务计划程序不支持选项“以最高特权运行".和“运行天气用户是否登录".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆