Not able to perform 'shutdown without sysprep' using powershell in windows server 2022

0

Hi everyone,

I am in the process of creating AWS AMIs for Windows Server 2022. After configuring the machine, I need to perform a 'shutdown without sysprep' using PowerShell with Launch V2. Although I can perform this action using the wizard (as shown in the attached screenshot), I'm having trouble with the PowerShell command.

Any help or assistance in this regard would be highly appreciated.

Thanks!

Enter image description here

suriya
asked 16 days ago239 views
3 Answers
0

Hello.

Will sysprep run if I shut down my computer with the command below?
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/stop-computer?view=powershell-7.4

Stop-Computer
profile picture
EXPERT
answered 16 days ago
profile picture
EXPERT
reviewed 16 days ago
  • No i think so

  • If i use this PowerShell command Stop-Computer and shutdown my instance and take a AMI of it It's showing the bellow error

    Password is not available. The instance was launched from a custom AMI, or the default password has changed. A password cannot be retrieved for this instance. If you have forgotten your password, you can reset it using the Amazon EC2 configuration service.

0

If i use this PowerShell command Stop-Computer and shutdown my instance and take a AMI of it It's showing the bellow error

Password is not available. The instance was launched from a custom AMI, or the default password has changed. A password cannot be retrieved for this instance. If you have forgotten your password, you can reset it using the Amazon EC2 configuration service.

suriya
answered 16 days ago
0

Hello all, I have manually run the following PowerShell script to prepare the machine without using Sysprep, and it works:

Start-Process -FilePath "$env:ProgramFiles\Amazon\EC2Launch\EC2Launch.exe" -Argument 'reset' -Wait
Stop-Computer

However, when I try to automate this process using Packer, I am unable to RDP into the machine. Can anyone help me resolve this issue?

Thanks, Suriya

suriya
answered 7 days ago