Provisioner "file" getting stuck in terraform

I am using following to copy and run powershell script on my aws instance but keep getting stuck

Error: timeout - last error: http response error: 401 - invalid content type

any idea why?

/*

Copy Scripts to EC2 instance

provisioner “file” {
source = “${path.module}/activedirectory/”
destination = “C:\scripts”
connection {
host = coalesce(self.public_ip, self.private_ip)
type = “winrm”
user = “Administrator”
password = var.admin_password
agent = “false”
}
}

Set Execution Policy to Remote-Signed, Configure Active Directory

provisioner “remote-exec” {
connection {
host = coalesce(self.public_ip, self.private_ip)
type = “winrm”
user = “Administrator”
password = var.admin_password
agent = “false”
https = “true”
port = “5986”
insecure = “true”
}
inline = [
“powershell.exe Set-ExecutionPolicy RemoteSigned -force”,
“powershell.exe -version 4 -ExecutionPolicy Bypass -File C:\scripts\01-ad_init.ps1”,
]
}
}

is there a better ay to run powershell script on aws instances?