puppetlabs/puppet · error · ArgumentError

Could not find command '%{exe}'

Error message

Could not find command '%{exe}'

What it means

Error "Could not find command '%{exe}'" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/provider/exec/windows.rb:41

    **Note on PowerShell scripts:** PowerShell's default `restricted`
    execution policy doesn't allow it to run saved scripts. To run PowerShell
    scripts, specify the `remotesigned` execution policy as part of the
    command:

        exec { 'test':
          path    => 'C:/Windows/System32/WindowsPowerShell/v1.0',
          command => 'powershell -executionpolicy remotesigned -file C:/test.ps1',
        }

  EOT

  # Verify that we have the executable
  def checkexe(command)
    exe = extractexe(command)

    if absolute_path?(exe)
      if !Puppet::FileSystem.exist?(exe)
        raise ArgumentError, _("Could not find command '%{exe}'") % { exe: exe }
      elsif !File.file?(exe)
        raise ArgumentError, _("'%{exe}' is a %{klass}, not a file") % { exe: exe, klass: File.ftype(exe) }
      end

      return
    end

    if resource[:path]
      Puppet::Util.withenv('PATH' => resource[:path].join(File::PATH_SEPARATOR)) do
        return if which(exe)
      end
    end

    raise ArgumentError, _("Could not find command '%{exe}'") % { exe: exe }
  end
end

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/provider/exec/windows.rb:41 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/ed14638595515a9b. Report an issue: GitHub.