0

I never use Windows; so bear with me here. I'm trying to make this simple; all I want to do is create a new user, with a defined password, that I can use to RDP to my instance on AWS.

I've put the following into a user-data script (And tried about 40 other different ways as well) to no avail.

<powershell>

cmd.exe /c net user /add developer myP@ssworD1
cmd.exe /c net localgroup administrators developer /add
cmd.exe /c NET LOCALGROUP "Remote Desktop Users" developer /ADD

</powershell>

My end-goal here is that I want to use provision an AMI with Packer, which I believe is working - but I can never login with AWS' means of "Get Windows Password" as it never resolves.

Any solution to get me past this step would be extremely helpful.

1
  • @rickard-von-essen I re-added the Packer tag. I can use my below answer to create a user perfectly fine using the base AMI that Packer will use; however as soon as I do the same with a Packer-built AMI it will not work. Possibly with the script used to setup WinRM; however I'm using the same script that is passed around everywhere for Windows-based Packer AMIs. Packer is the common denominator in this failure. Commented Sep 14, 2017 at 17:17

2 Answers 2

2

Solution was to wrap in <script></script> instead while dropping the cmd.exe; and looks as if adding to the RDP group was not necessary.

<script>

net user /add developer myP@ssworD1
net localgroup administrators developer /add

</script>
Sign up to request clarification or add additional context in comments.

Comments

0
net user /add developer myP@ssworD1
net localgroup administrators developer /add
net localgroup "Remote Desktop Users" developer /add

1 Comment

Can you edit your answer to provide more context? Are you suggesting the OP input the above as commands? If so, can you format it as code for clarity? Please be sure to write each command on its own line, so others know if this is one command or several.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.