vmware-samples/packer-examples-for-vsphere

PowerShell provisioner error on Windows 10 and 11

tenthirtyam opened this issue · 1 comments

Discussed in #858

Originally posted by shaneholloman March 21, 2024
I have managed to build every linux distro and every Windows Server variant.
However I can not build the Windows 10 and 11 desktops.

My ENV

  shadmin @ kea ❯ ~ uname -a
Linux kea 6.5.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 10:22:43 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
  shadmin @ kea ❯ ~ powershell --version
PowerShell 7.4.1
  shadmin @ kea ❯ ~ packer --version
Packer v1.10.2
  shadmin @ kea ❯ ~ terraform --version
Terraform v1.7.5
on linux_amd64
  shadmin @ kea ❯ ~ ansible --version
ansible [core 2.16.4]
  config file = None
  configured module search path = ['/home/shadmin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/shadmin/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/shadmin/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/shadmin/.local/bin/ansible
  python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True
  shadmin @ kea ❯ ~ 

I am immediately blocked with this message:

CONFIRM: Build a Windows 10 - Professional Only Template for VMware vSphere?

Continue? (y/n)
y
Building a Windows 10 - Professional Only Template for VMware vSphere...
Initializing HashiCorp Packer and required plugins...
Starting the build....
packer build -force -on-error=ask 
Error: Failed preparing provisioner-block "powershell" ""

  on /home/<sensitive>/Dropbox/shane/git/it/vsphere-packer/builds/windows/desktop/10/windows.pkr.hcl line 283:
  (source code not available)

1 error(s) occurred:

* Either a script file or inline script must be specified.

The error points to this block

...
  provisioner "powershell" {
    elevated_user     = var.build_username
    elevated_password = var.build_password
    inline            = var.inline
  }
...

Which is not used for the server variants of windows builds. Just for win 10 and 11.

I have to admit my ignorance here, I don't know how to fix this.
Theres no docs describing, this issue, or if it's not an issue, no docs showing how to run these differently from the other 25 or so succesful builds

Maybe it isn't broken to begin with?

It would be nice to work out why the server variants build without issue, where as the win 10 and 11 desktops dont because of this difference.

Again sorry for my ignorance : )

I'm going to lock this issue because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.