Configure o script fornecido pela Amazon, C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeDisks.ps1
, para ser executado quando o sistema for inicializado.
-
Faça login como administrador.
-
Crie um arquivo XML temporário com o conteúdo mostrado abaixo.
-
Inicie o Agendador de Tarefas do Windows. (Iniciar > > Ferramentas administrativas > > Agendador de tarefas)
-
Selecione Ações , Importar tarefa ...
-
Selecione seu arquivo XML temporário.
-
Pressione OK para criar a tarefa.
Lançamento do Amazon Ec2 - Initialize Disks.xml
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<URI>\Amazon Ec2 Launch - Initialize Disks</URI>
</RegistrationInfo>
<Triggers>
<BootTrigger>
<Enabled>true</Enabled>
</BootTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-18</UserId>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>false</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>false</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
<Priority>0</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>C:\Windows\System32\cmd.exe</Command>
<Arguments>/C C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Unrestricted -File "C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeDisks.ps1"</Arguments>
</Exec>
</Actions>
</Task>
Eu percebi isso com pistas de aqui