スケジュールされたタスクを使用してそれを行う必要がありました。
マッピング テキストを含む標準のバッチ ファイルを作成します。
`
net use R: /Delete /y
net use R: "\\SERVERNAME\R" /persistent:yes
net use S: /Delete /y
net use S: "\\SERVERNAME\S" /persistent:yes
`
Scheduled Taks ジョブ情報を使用して 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-03-12T14:19:18.8527017</Date>
<Author>DOMAIN\USER</Author>
</RegistrationInfo>
<Triggers />
<Principals>
<Principal id="Author">
<GroupId>S-1-5-32-544</GroupId>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</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>P3D</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>I:\Scripts\Schedualed Taks XML\Maps.bat</Command>
</Exec>
</Actions>
</Task>
`
バッチ ファイルを使用してタスクを作成する (schtasks.exe)
`
@echo off
if exist "exists.txt" del "exists.txt"
for /F %%A in (SNL.txt) do (
Echo %%A
schtasks.exe /create /f /tn "Map Drives" /XML "I:\Scripts\Schedualed Taks XML\DriveMaps.xml" /s %%A
)
pause
`
注: SNL.txt は、タスクをクレートするコンピューターのリストです。
次に、バッチ ファイルを使用してタスクを実行します(必要に応じて、この 1 つのバッチ ファイルを作成できます)。
`
@echo off
if exist "exists.txt" del "exists.txt"
for /F %%A in (SNL.txt) do (
Echo %%A
schtasks.exe /run /s %%A /tn "Map Drives"
)
Pause
`