We have a single packer file that is intended to work for Linux and Windows. It creates a builder (“linux” or “windows”) and then runs several provisioners. Linux part works just fine. We are working on “windows” builder, and obviously need to replace all the “shell” provisioner with a windows equivalent - “powershell” being the obvious choice… Cannot get it to work right. I want to start by prefacing this with - we are using SSH transport for both windows and linux, since WinRM is incapable of handling data transfers in any sort of a reasonable volume (takes a minute under ssh, takes hours and hours under WinRM, not sure how long, never had the patience to wait that long) (Note: we are using the MS provided build of OpenSSH, to be clear)
Anyway, when using a “powershell” provisioner in Windows (Server 19) via SSH - it just does not work. The screen gets corrupted (a wall full of windows:
lines) and … it hangs until it times out. Tried a lot of options, nothing seems to change it. I can see it transferring the PS file there and a PS wrapper to execute it, and tries to run it, and then nothing. Same thing happens with a simple inline one-liner - so it is not the content of the script.
Meanwhile, “windows-shell” seems to work just fine. We are in process of rewriting everything in batch, but PS is so much more powerful - it seems a shame to go back to 1980’s tech… Any ideas?