Build Hyper-V VM with hyperv-iso from Ubuntu

I’m trying to build a Hyper-V VM using hyperv-iso builder, from Ubuntu. I have a Hyper-V server in the cloud with SSH credentials, but when I try to build, I just get this error:

sgd-hyperv: output will be in this color.

Build 'sgd-hyperv' errored: Failed creating Hyper-V driver: Applies to Windows 8.1, Windows PowerShell 4.0, Windows Server 2012 R2 only

==> Some builds didn't complete successfully and had errors:
--> sgd-hyperv: Failed creating Hyper-V driver: Applies to Windows 8.1, Windows PowerShell 4.0, Windows Server 2012 R2 only

==> Builds finished but no artifacts were created.

I’m able to successfully build VMWare and Virtualbox images with packer.

Is it just not possible to build Hyper-V images from linux with packer? There’s nothing in the docs saying that?

My config for this build:

{
      "boot_command": [
        "<enter><wait>",
        "<f6><esc>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs>",
        "/install/vmlinuz ",
        "passwd/root-password-again\"{{user `root_password`}}\" ",
        "passwd/root-password=\"{{user `root_password`}}\" ",
        "passwd/user-fullname=\"{{user `ssh_user`}}\" ",
        "passwd/username=\"{{user `ssh_user`}}\" ",
        "passwd/user-password=\"{{user `ssh_user_password`}}\" ",
        "passwd/user-password-again=\"{{user `ssh_user_password`}}\" ",
        "user-setup/allow-password-weak boolean true ",
        "initrd=/install/initrd.gz ",
        "net.ifnames=0 ",
        "auto-install/enable=true ",
        "debconf/priority=critical ",
        "preseed/file=/floppy/preseed-supervisor.cfg ",
        "<enter>"
      ],
      "boot_wait": "30s",
      "disk_size": "{{user `disk_size`}}",
      "floppy_files": [
        "http/ubuntu-16.04/preseed-supervisor.cfg"
      ],
      "headless": "{{user `headless`}}",
      "http_directory": "http",
      "iso_checksum": "{{user `iso_checksum_type`}}:{{user `iso_checksum`}}",
      "iso_url": "{{user `mirror`}}/{{user `mirror_directory`}}/{{user `iso_name`}}",
      "keep_registered": "{{user `esxi_keep_registered`}}",
      "name": "sgd-hyperv",
      "output_directory": "output-ubuntu-16.04.2_64-{{build_type}}",
      "shutdown_command": "echo '{{ user `ssh_user_password` }}' | sudo -S /sbin/shutdown -P now",
      "shutdown_timeout": "20m",
      "ssh_host": "<redacted>",
      "ssh_password": "<redacted>",
      "ssh_timeout": "60m",
      "ssh_username": "<redacted>",
      "type": "hyperv-iso",
      "vm_name": "supervisor-{{user `supervisor_build_string` }}-{{timestamp}}"
    }

any help would be greatly appreciated!

I don’t think you can use Packer to build on a remote machine. You need to run it on the same machine where hyper-v is installed.