I am trying to run below code as PowerShell provisioner inline but Packer throws error “Provisioning step had errors”
{
"type": "powershell",
"inline":[
"$NewCert=New-SelfSignedCertificate -CertstoreLocation Cert:\\LocalMachine\\My -DnsName 'packer'",
"New-Item -Path WSMan:\\LocalHost\\Listener -Transport HTTPS -Address * -CertificateThumbPrint $NewCert.Thumbprint -Force"
]
}
At the end, I get this error message…
==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: Error processing command: Error uploading ps script containing env vars: Error uploading file to $env:TEMP\winrmcp-9d237844-bb3d-4226-5149-8221a9f046b1.tmp: Couldn't create shell: http response error: 401 - invalid content type
==> Builds finished but no artifacts were created.
If I increase the logs then the screen is filled with invalid content type errors…
Error processing command: Error uploading ps script containing env vars: Error uploading file to $env:TEMP\winrmcp-9d237844-bb3d-4226-5149-8221a9f046b1.tmp: Couldn't create shell: http response error: 401 - invalid content type