Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Bug: CommandNotFoundException for SystemSettingsAdminFlows breaks script on line 1069

Đã đóng Phù hợp với người mới
#250 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
74/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
powershell
Lĩnh vực
operating-systems

Hướng nghiên cứu

Bắt đầu tại dòng 1069 trong script PowerShell và tái hiện lỗi khi SystemSettingsAdminFlows không khả dụng. Kiểm tra các cách sử dụng Get-Command khác được đề cập trong issue để xác định cùng kiểu lỗi. Hoàn thành khi giai đoạn loại bỏ Edge AI bỏ qua một lệnh bị thiếu và tiếp tục mà không gặp CommandNotFoundException không được xử lý.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
PowerShell
Star
13.4k
Fork
470
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của zoicware/RemoveWindowsAI

Tất cả issue của zoicware/RemoveWindowsAI

Issue tương tự

Thêm issue về Operating Systems

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.