PowerShell is not recognized as an internal or external command

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

A Script Task from a deployment or build plan may fail with the following error:

PowerShell is not recognized as an internal or external command, operable program or batch file

環境

Bamboo (or its agents) running on Windows OS.

診断

If your Bamboo version is 6.10.2 or older, please beware of the following bug:

However, if you're running a more recent version of Bamboo, or you also experience this issue when running the PowerShell command directly from Windows' Command Prompt, please proceed with the below.

原因

This is caused by the user (or system) PATH environment variable not containing the directory where the PowerShell executable resides. It's usually located at C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe, and although the PATH variable contains the C:\Windows\System32 directory, Windows may have trouble locating the executable within its subfolders.

ソリューション

The solution consists of adding the directory where the PowerShell executable resides to the PATH environment variable.

  1. Search for "environment variables" in the Windows search bar and open the respective Control Panel item.
  2. A System Properties window will appear. Click on "Environment Variables" at the bottom.
  3. Edit the PATH environment variable and add the path to the folder where PowerShell is located.
  4. For the changes to be picked up, the agent needs to be restarted. You may also need to restart the machine so all of the other Windows portions pick up the new variable.

最終更新日 2021 年 11 月 30 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.