hashicorp/vagrant · error · Vagrant::Errors::PowerShellNotFound
Failed to locate the powershell executable on the available
Error message
Failed to locate the powershell executable on the available PATH. Please ensure powershell is installed and available on the local PATH, then run the command again.
What it means
Vagrant::Util::PowerShell.validate_install! memoizes its result and, on first call, raises PowerShellNotFound when available? is false — no powershell executable could be located on PATH. Windows-side features (elevated shell, Hyper-V operations, network configuration) call this before executing anything through PowerShell.
Source
Thrown at lib/vagrant/util/powershell.rb:246
timeout: timeout,
) {|io_name,data| version = data}
rescue Vagrant::Util::Subprocess::TimeoutExceeded
LOGGER.debug("Timeout exceeded while attempting to determine version of Powershell.")
end
@_powershell_version = version
end
@_powershell_version
end
# Validates that powershell is installed, available, and
# at or above minimum required version
#
# @return [Boolean]
# @raises []
def self.validate_install!
if !defined?(@_powershell_validation)
raise Errors::PowerShellNotFound if !available?
if version.to_i < MINIMUM_REQUIRED_VERSION
raise Errors::PowerShellInvalidVersion,
minimum_version: MINIMUM_REQUIRED_VERSION,
installed_version: version ? version : "N/A"
end
@_powershell_validation = true
end
@_powershell_validation
end
# Powerup the given command to perform privileged operations.
#
# @param [String] path
# @param [Array<String>] args
# @return [Array<String>]
def self.powerup_command(path, args, opts)
Dir.mktmpdir("vagrant") do |dpath|
all_args = [path] + args.flatten.map{ |a|View on GitHub (pinned to 35f3160f4a)
Solutions
- Install Windows PowerShell (built into full Windows; add via `Add-WindowsCapability` on stripped images)
- Add the PowerShell directory (typically C:\Windows\System32\WindowsPowerShell\v1.0\) to PATH
- Restart the terminal/service so the updated PATH reaches Vagrant, then confirm with `where powershell`
Example fix
# before: powershell missing from the CI agent's PATH > vagrant up # PowerShellNotFound # after (Windows) > setx PATH "%PATH%;C:\Windows\System32\WindowsPowerShell\v1.0" > vagrant up
Defensive patterns
Strategy: validation
Validate before calling
require 'vagrant/util/powershell' unless Vagrant::Util::PowerShell.available? abort 'powershell is not on PATH; install it or fix PATH before continuing' end
Try / catch
begin Vagrant::Util::PowerShell.validate_install! rescue Vagrant::Errors::PowerShellNotFound abort 'install Windows PowerShell and ensure it is on PATH' end
Prevention
- Assert PowerShell availability in provisioning scripts before vagrant runs
- Do not strip System32 PowerShell paths from service environments
- Verify with `where powershell` in the shell that runs vagrant
When it happens
Trigger: Any Windows-path code that shells out through PowerShell when powershell(.exe) is absent from PATH: Server Core images without PowerShell on PATH, sanitized PATH in service/CI agent contexts, or PowerShell genuinely not installed.
Common situations: CI agents running as services with a minimal PATH; broken PATH/PATHEXT after system tweaks; custom stripped Windows container images.
Related errors
- `ssh` executable not found in any directories in the %PATH%
- The executable '%{file}' Vagrant is trying to run was not fo
- The version of powershell currently installed on this host i
- The executable '%{file}' Vagrant is trying to run was not fo
- A command must be provided when the --elevated flag is provi
AI-assisted analysis of hashicorp/vagrant@35f3160f4a (2026-08-21).
Data as JSON: /api/errors/2b10c9318e77072d.
Report an issue: GitHub.