Sysprep command on AWS ec2 windows

 I recently ran sysprep command on ec2 vm running windows server. (sysprep.exe /oobe /generalize /shutdown which was provided by one of the popular AI/chat tools). The sysprep command ran fine. The initial intent was to create an AMI from this instance. 

After sysprep command completed the ec2 instance stopped and next followed steps for creating an AMI. Steps were straight forward no issues. After I started this ec2 vm via AWS console, it showed as successfully started- however I could not rdp into this server. Looks like sysprep command has caused this issue. I got the system log for this ec2 instance (it is available via the AWS console) and it shows as below

Windows is being configured. 'SysprepState=IMAGE_STATE_UNDEPLOYABLE'

This means that rdp into this instance will not be possible. Essentially when you run Sysprep (especially with the /generalize and /oobe switches) on an EC2 instance, you are resetting Windows back to a state where it’s expecting to run first-boot configuration again. This is normal for creating a “golden image” or capturing an AMI, but it also means that the original instance you sysprepped can become unusable—particularly for Remote Desktop (RDP) connections—unless you have or had additional steps in place to handle that first-boot configuration in AWS. 

I checked AWS documentation to confirm that now it will not be possible to rdp into this instance since the local admin password is reset after sysprep and some services are reinstalled.

In summary, do not run sysprep command if you are trying to create an AMI. In fact you do not need to run the sysprep command for creating an AMI.

Comments

  1. The Sysprep command on AWS EC2 for Windows helps prepare the system for imaging and scaling. For seamless performance, rely on hostingmella for your hosting needs!

    ReplyDelete

Post a Comment

Popular posts from this blog

VMware fix for Invalid manifest and ova file import failed errors

Session Timeout in Oracle Access Manager

SOAPUI - import certificate