title: CloudFormation change windows computer name
body: <p>I'm trying to add the Rename-Computer line into a CloudFormation script but it is not doing anything, I know that I have to use the UserData property inside the resource stage, I see some examples and also the AWS CloudFormation documentation, but I think I'm missing something, in the examples, they just invoke the PowerShell command (As I did below) and it works, but for me is not doing anything, can someone help me with this? If anyone has a better example that it is already working I will appreciate it.</p>
  <pre><code>  &quot;Resources&quot; : {
      &quot;EC2InstanceOne&quot;:{
        &quot;Type&quot;:&quot;AWS::EC2::Instance&quot;,
        &quot;DeletionPolicy&quot; : &quot;Retain&quot;,
        &quot;Properties&quot;:{
          &quot;InstanceType&quot;:{ &quot;Ref&quot; : &quot;InstanceType&quot; },
          &quot;SubnetId&quot;: { &quot;Ref&quot; : &quot;MySubnetVM1&quot; },
          &quot;SecurityGroupIds&quot;:[ { &quot;Ref&quot; : &quot;SGUtilized&quot; } ],
          &quot;SecurityGroupIds&quot;:[ { &quot;Ref&quot; : &quot;SGUtilized2&quot; } ],
          &quot;IamInstanceProfile&quot;  : { &quot;Ref&quot; : &quot;RoleName&quot; },
          &quot;KeyName&quot;: { &quot;Ref&quot; : &quot;ServerKeyName&quot; },
          &quot;ImageId&quot;:{ &quot;Ref&quot; : &quot;AMIUtilized&quot; },
          &quot;BlockDeviceMappings&quot; : [
                 {
                    &quot;DeviceName&quot; : &quot;/dev/sda1&quot;,
                    &quot;Ebs&quot; : {
                       &quot;VolumeType&quot; : &quot;standard&quot;,
                       &quot;DeleteOnTermination&quot; : &quot;false&quot;,
                       &quot;VolumeSize&quot; : &quot;50&quot;
                    }
                 }
              ],
                  &quot;UserData&quot; : { &quot;Fn::Base64&quot; : { &quot;Fn::Join&quot; : [ &quot;&quot;, [
                          &quot;powershell.exe Rename-Computer -NewName TESTVM01&quot;,
                          &quot;powershell.exe Restart-Computer&quot;
                  ]
              ]
            }
          }
        }
      }
    }
  </code></pre>
  <p>Thanks, best regards.</p>