Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Bug: CommandNotFoundException for SystemSettingsAdminFlows breaks script on line 1069

クローズ 初心者向け
#250 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
powershell

調査の方向性

PowerShell スクリプトの 1069 行目から始め、SystemSettingsAdminFlows が利用できない場合の失敗を再現します。issue で言及されている他の Get-Command の使用箇所についても、同じ失敗モードを確認します。Edge AI の削除フェーズが存在しないコマンドをスキップし、未処理の CommandNotFoundException を発生させずに処理を続行できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

Title: Script crashes during Edge AI removal: Get-Command SystemSettingsAdminFlows throws CommandNotFoundException (line 1069)

Describe the bug

The script crashes at line 1069 during the Edge AI removal phase with a CommandNotFoundException.

The script checks for SystemSettingsAdminFlows like this:

if (Test-Path (get-command SystemSettingsAdminFlows).Source) {

If SystemSettingsAdminFlows is missing from the system (e.g. it was previously removed or debloated), Get-Command raises an error, and the script stops before Test-Path can evaluate to $false. Most likely the error becomes terminating because of $ErrorActionPreference = 'Stop' set in the script.

Steps to reproduce
  1. Use a system where SystemSettingsAdminFlows.exe is missing or unavailable in PATH.
  2. Run the script and proceed to the Edge AI removal phase.
  3. The script fails at line 1069.
Expected behavior

If SystemSettingsAdminFlows is not found, the script should skip this step and continue.

Actual behavior

The script terminates with an unhandled error.

Error log
get-command : Имя "SystemSettingsAdminFlows" не распознано как имя командлета, функции, файла сценария или выполняемой программы. Проверьте правильность написания имени, а также наличие и правильность пути, после чего повторите попытку.
строка:1069 знак:20
+ if (Test-Path (get-command SystemSettingsAdminFlows).Source) {
+ CategoryInfo : ObjectNotFound: (SystemSettingsAdminFlows:String) [Get-Command], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand
Suggested fix

Option 1 (minimal): suppress the error and check the result.

$cmd = Get-Command SystemSettingsAdminFlows -CommandType Application -ErrorAction SilentlyContinue
if ($cmd) {
    # Proceed with execution
}

Option 2 (most predictable): check the file by its full path, without depending on PATH.

$exe = Join-Path $env:SystemRoot 'System32\SystemSettingsAdminFlows.exe'
if (Test-Path -LiteralPath $exe) {
    # Proceed with execution
}

-CommandType Application excludes functions and aliases, whose .Source can be empty or a module name, so the extra Test-Path is not needed in Option 1.

Additional notes

Other Get-Command ...).Source calls elsewhere in the script may have the same problem when a component was already removed. It's worth auditing all Get-Command usages and adding -ErrorAction SilentlyContinue or a full-path check.

Environment
  • OS: Windows 11 25h2
  • PowerShell: 5.1
  • Script version / commit: Latest as of 30.09.2026
主要言語
PowerShell
スター
13.3k
フォーク
467
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

zoicware/RemoveWindowsAI のほかの issue

zoicware/RemoveWindowsAI の issue をすべて見る

似ている issue

Operating Systems の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。