{"record":{"id":"2b10c9318e77072d","repo":"hashicorp/vagrant","slug":"failed-to-locate-the-powershell-executable-on-the","errorCode":null,"errorMessage":"Failed to locate the powershell executable on the available PATH. Please\nensure powershell is installed and available on the local PATH, then\nrun the command again.","messagePattern":"Failed to locate the powershell executable on the available PATH\\. Please\nensure powershell is installed and available on the local PATH, then\nrun the command again\\.","errorType":"exception","errorClass":"Vagrant::Errors::PowerShellNotFound","httpStatus":null,"severity":"error","filePath":"lib/vagrant/util/powershell.rb","lineNumber":246,"sourceCode":"              timeout: timeout,\n            ) {|io_name,data| version = data}\n          rescue Vagrant::Util::Subprocess::TimeoutExceeded\n            LOGGER.debug(\"Timeout exceeded while attempting to determine version of Powershell.\")\n          end\n\n          @_powershell_version = version\n        end\n        @_powershell_version\n      end\n\n      # Validates that powershell is installed, available, and\n      # at or above minimum required version\n      #\n      # @return [Boolean]\n      # @raises []\n      def self.validate_install!\n        if !defined?(@_powershell_validation)\n          raise Errors::PowerShellNotFound if !available?\n          if version.to_i < MINIMUM_REQUIRED_VERSION\n            raise Errors::PowerShellInvalidVersion,\n              minimum_version: MINIMUM_REQUIRED_VERSION,\n              installed_version: version ? version : \"N/A\"\n          end\n          @_powershell_validation = true\n        end\n        @_powershell_validation\n      end\n\n      # Powerup the given command to perform privileged operations.\n      #\n      # @param [String] path\n      # @param [Array<String>] args\n      # @return [Array<String>]\n      def self.powerup_command(path, args, opts)\n        Dir.mktmpdir(\"vagrant\") do |dpath|\n          all_args = [path] + args.flatten.map{ |a|","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/hashicorp/vagrant/blob/35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5/lib/vagrant/util/powershell.rb#L228-L264","documentation":"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.","triggerScenarios":"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.","commonSituations":"CI agents running as services with a minimal PATH; broken PATH/PATHEXT after system tweaks; custom stripped Windows container images.","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`"],"exampleFix":"# before: powershell missing from the CI agent's PATH\n> vagrant up   # PowerShellNotFound\n\n# after (Windows)\n> setx PATH \"%PATH%;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\"\n> vagrant up","handlingStrategy":"validation","validationCode":"require 'vagrant/util/powershell'\n\nunless Vagrant::Util::PowerShell.available?\n  abort 'powershell is not on PATH; install it or fix PATH before continuing'\nend","typeGuard":null,"tryCatchPattern":"begin\n  Vagrant::Util::PowerShell.validate_install!\nrescue Vagrant::Errors::PowerShellNotFound\n  abort 'install Windows PowerShell and ensure it is on PATH'\nend","preventionTips":["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"],"tags":["powershell","windows","path","executable"],"backgroundTag":"executable-not-found-in-path","analyzedSha":"35f3160f4ad6edc3a9f3aa9570adfc1a4d73aaa5","analyzedAt":"2026-08-21T13:34:32.514Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}