Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Bug: CommandNotFoundException for SystemSettingsAdminFlows breaks script on line 1069

Aperta Adatta ai principianti
#250 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
powershell

Direzione di ricerca

Inizia dalla riga 1069 dello script PowerShell e riproduci il malfunzionamento quando SystemSettingsAdminFlows non è disponibile. Esamina gli altri utilizzi di Get-Command menzionati nell’issue per verificare la presenza dello stesso tipo di errore. Il lavoro è completato quando la fase di rimozione di Edge AI salta un comando mancante e continua senza una CommandNotFoundException non gestita.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
PowerShell
Stelle
13.1k
Fork
459
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di zoicware/RemoveWindowsAI

Tutte le issue di zoicware/RemoveWindowsAI

Issue simili

Altre issue su Operating Systems

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.