Terraform ssh connection to Windows 10 “The directory name is invalid”

I have the following Terraform code at an attempt to remotely generalize a Windows 10 box via “remote-exec”. I have already enabled openssh-server on Windows 10 and I can connect fine. After it connects it then has an error “The directory name is invalid”. Even commands like “dir” or “hostname” have this error.

Code:

resource "null_resource" "generalize_vm" {
  provisioner "remote-exec" {
    connection {
    user     = var.vm_username
    password = var.vm_password
    host     = "ip"
    }

    inline = [
      "dir",
    ]
  }
}

Terraform apply:

module.vm.null_resource.generalize_vm (remote-exec): Connecting to remote host via SSH...
module.vm.null_resource.generalize_vm (remote-exec):   Host: ip
module.vm.null_resource.generalize_vm (remote-exec):   User: username
module.vm.null_resource.generalize_vm (remote-exec):   Password: true
module.vm.null_resource.generalize_vm (remote-exec):   Private key: false
module.vm.null_resource.generalize_vm (remote-exec):   Certificate: false
module.vm.null_resource.generalize_vm (remote-exec):   SSH Agent: false
module.vm.null_resource.generalize_vm (remote-exec):   Checking Host Key: false
module.vm.null_resource.generalize_vm (remote-exec): Connected!
module.vm.null_resource.generalize_vm (remote-exec):




















                                                     The directory name is invalid.
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm (remote-exec):
module.vm.null_resource.generalize_vm: Creation complete after 1s [id=4268925703469176082]
module.vm.null_resource.generalize_vm (remote-exec):
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

I have tried both Terraform on Windows and Linux. Is remote-exec for ssh expecting only bash syntax? Would be great if remote-exec can exec commands over ssh like open-ssh does. I can use ssh username@ ‘ipconfig’ to exec remote commands in open-ssh.