
안녕하세요. 저는 작업 스케줄러에 작업을 추가하기 위해 몇 가지 스크립팅을 하고 있습니다. 그러나 "최고 권한으로 실행"을 선택하려면 스크립트가 필요합니다.
샘플 코드:
Dim settings
Set settings = taskDefinition.Settings
settings.Enabled = True
settings.StartWhenAvailable = True
settings.Hidden = False
답변1
PowerShell에서 -RunLevel Highest
플래그를 사용하여 이를 수행할 수 있습니다 .New-ScheduledTaskPrincipal
예:
# Set the scheduled task time and repitition
$TaskTime = New-ScheduledTaskTrigger -Daily -At 12:00
# Set the task to run as a local administrator with highest level privileges
$TaskUser = New-ScheduledTaskPrincipal -GroupId "BUILTIN\Administrators" -RunLevel Highest
# Set actions the schedule task should perform
$Action1 = New-ScheduledTaskAction -Execute "chrome.exe"
$Action2 = New-ScheduledTaskAction -Execute "notepad.exe"
# Registers the task with Task Scheduler
Register-ScheduledTask "Test Scheduled Task" -Action $Action1,$Action2 -Principal $TaskUser