배치 파일로 XML 파일에서 일정 작업 생성 </Repetition>

테스트 시스템에 일정 작업이 있습니다. 테스트 머신은 승리 7입니다. XML로 작업을 내보내고 500 개가 넘는 머신에서 동일한 일정 작업을 만들어야하므로 새로운 유사한 일정 작업을 만들려고합니다.

스케줄 작업을위한 배치 파일을 만들 계획입니다. 대부분의 컴퓨터는 동일한 도메인에 있습니다. 그래서 인증을 위해 서비스 계정을 사용할 계획입니다.

아래는 xml 파일입니다. 이것은 작업 스케줄러에서 현재 잘 작동합니다.

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2016-01-26T19:26:36.6011086</Date>
    <Author>test\404</Author>
    <Description>Testing Tasks</Description>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <Repetition>
        <Interval>PT1H</Interval>
        <Duration>P1D</Duration>
        <StopAtDurationEnd>false</StopAtDurationEnd>
      </Repetition>
      <StartBoundary>2016-01-26T19:25:42.7621086</StartBoundary>
      <EndBoundary>2017-01-26T19:25:43.0101086</EndBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>test\404</UserId>
      <LogonType>Password</LogonType>
      <RunLevel>LeastPrivilege</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
    <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>copier.bat</Command>
      <WorkingDirectory>D:\test\</WorkingDirectory>
    </Exec>
  </Actions>
</Task>

아래 명령을 사용하여 비슷한 일정 작업을 만들려고 할 때.

schtasks /create /tn "alarm3" /xml "Test Task.xml"

오류
ERROR : 로그온 실패 : 알 수없는 사용자 이름 또는 암호가 잘못되었습니다.

배치 파일을 사용하여 일정 작업을 만드는 방법을 알고 싶습니다. 일정 작업은 Win 2003 에서 Win 2012 서버 와 호환되어야 합니다 .

시간 내 줘서 고마워.



답변

schtasks작업 사용자 자격 증명을 사용 하고 제공 할 수 있습니다 . PowerShell 스크립트에서 정기적으로 사용합니다.

schtasks.exe /create /s NAMEOFCOMPUTER /ru DOMAIN\USER /rp PASSWORD /tn NAMEOFTASK' /XML PATHTOXMLFILE


답변