Bug: CommandNotFoundException for SystemSettingsAdminFlows breaks script on line 1069
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
- Ambito
- operating-systems
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
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
- Use a system where
SystemSettingsAdminFlows.exeis missing or unavailable inPATH. - Run the script and proceed to the Edge AI removal phase.
- 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
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di zoicware/RemoveWindowsAI
-
classic paint app brokenApertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
zoicware/RemoveWindowsAI#249 · 2 commenti ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
zoicware/RemoveWindowsAI#247 · 5 commenti ·
-
Improve logging functionForse di nuovo libera @zoicware l’ha presa 42 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
zoicware/RemoveWindowsAI#232 · 2 commenti · 1 assegnatario ·
-
enhancement help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
zoicware/RemoveWindowsAI#213 · 8 commenti ·
-
Windows Update Repair OptionForse di nuovo libera @zoicware l’ha presa 210 giorni fa e non c’è nessuna pull request aperta. Apertadocumentation leave open
zoicware/RemoveWindowsAI#180 · 8 commenti · 1 assegnatario ·
Tutte le issue di zoicware/RemoveWindowsAI
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 2 giorni
-
component:ktuner
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
agentic-os-org/ANOLISA#3785 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
microsoft/WindowsDeveloperConfig#127 ·
I maintainer di solito rispondono entro 1 giorno