Visits: 3444
In Windows PowerShell, run the following command to schedule the script to run as a Windows Scheduled Task. The script runs one time during the next boot and then disables these tasks from running again.
PS C:\> C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 -Schedule
Also see from our Blog:
Prepare AMI for AWS Marketplace – Reset Linux ec2 Image – delete public keys, etc
https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2launch.html