基本は新しいバージョンのPowerShellをインストールすれば、そちらを使う動作になるようです。
最新版のPowerShell (PowerShell 7) のインストール方法はこちらの記事参照してください。
Codexで次の指示を出して、どのPowerShellが利用されているかを確認できます。
回答は以下になります。(一例)
なるべくバージョン7のPowerShellが利用されるよう、プロジェクトディレクトリ直下の AGENTS.md ファイルに以下の記述を追記します。
## Shell
- On Windows, always use PowerShell 7 via `pwsh`, not `powershell.exe`.
- If a command must be run in PowerShell, prefer `pwsh -NoLogo -NoProfile -Command "..."`
- When checking the current shell, verify with `$PSVersionTable.PSVersion`.
以上の設定により、CodexがPowerShell のバージョン7を実行して処理をする確率が上がります。