hashicorp/vagrant · error · VagrantPlugins::CommandPS::Errors::HostUnsupported
Your host does not support PowerShell. A remote PowerShell c
Error message
Your host does not support PowerShell. A remote PowerShell connection can only be made from a windows host.
What it means
The interactive `vagrant powershell` path requires the host to expose the ps_client host capability, which only Windows hosts implement. When @env.host.capability?(:ps_client) is false (macOS/Linux), Vagrant raises Errors::HostUnsupported. The --command branch bypasses this check by executing through the guest's winrm communicator instead.
Source
Thrown at plugins/commands/powershell/command.rb:74
raise Vagrant::Errors::VMNotCreatedError
end
if options[:command]
if machine.config.vm.communicator != :winrm
raise VagrantPlugins::CommunicatorWinRM::Errors::WinRMNotReady
end
out_code = machine.communicate.execute(options[:command].dup, elevated: options[:elevated]) do |type,data|
machine.ui.detail(data) if type == :stdout
end
if out_code == 0
machine.ui.success("Command: #{options[:command]} executed successfully with output code #{out_code}.")
end
next
end
# Check if the host even supports ps remoting
raise Errors::HostUnsupported if !@env.host.capability?(:ps_client)
ps_info = VagrantPlugins::CommunicatorWinRM::Helper.winrm_info(machine)
ps_info[:username] = machine.config.winrm.username
ps_info[:password] = machine.config.winrm.password
# Extra arguments if we have any
ps_info[:extra_args] = options[:extra_args]
result = ready_ps_remoting_for(machine, ps_info)
machine.ui.detail(
"Creating powershell session to #{ps_info[:host]}:#{ps_info[:port]}")
machine.ui.detail("Username: #{ps_info[:username]}")
begin
@env.host.capability(:ps_client, ps_info)
ensure
if result["PreviousTrustedHosts"]
reset_ps_remoting_for(machine, ps_info)View on GitHub (pinned to 35f3160f4a)
Solutions
- Run the command from a Windows host for interactive sessions.
- On non-Windows hosts, use command mode with the winrm communicator: set `config.vm.communicator = "winrm"` in the Vagrantfile, then `vagrant powershell --command "whoami"`.
- Or manage the guest over SSH where an OpenSSH server is available.
Example fix
# before (on macOS/Linux) vagrant powershell # HostUnsupported # after # Vagrantfile: config.vm.communicator = "winrm" vagrant powershell --command "whoami"
Defensive patterns
Strategy: validation
Validate before calling
require 'rbconfig'
abort 'interactive vagrant powershell requires a Windows host; use --command with the winrm communicator instead' unless RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
system('vagrant', 'powershell') Try / catch
begin Vagrant::Environment.new.cli(['powershell']) rescue VagrantPlugins::CommandPowershell::Errors::HostUnsupported => e warn e.message # fall back: --command via winrm, or vagrant ssh exit 1 end
Prevention
- Gate interactive `vagrant powershell` on the host being Windows.
- Default to `--command` plus `config.vm.communicator = "winrm"` for cross-platform automation.
- Document host requirements in the project README so Mac/Linux contributors do not hit it.
When it happens
Trigger: Running `vagrant powershell` (no --command) on macOS or Linux; the check fires before any session is attempted, after winrm_info resolution is prepared.
Common situations: Developers on Mac/Linux managing Windows guests; following Windows-host-oriented docs; forgetting that only the interactive remote session is host-restricted.
Related errors
- A command must be provided when the --elevated flag is provi
- The Hyper-V cmdlets for PowerShell are not available! Vagran
- Vagrant cannot create an iso due to the host capability for
- Failed to locate the powershell executable on the available
- The version of powershell currently installed on this host i
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/bdb1945a0dd31037.
Report an issue: GitHub.