From 37db28c175cc309c32c66d37962adf1b869aa0e6 Mon Sep 17 00:00:00 2001 From: David Bennett Date: Tue, 7 Oct 2025 14:26:29 -0700 Subject: [PATCH] Add admin check to uninstall of machine font --- src/AppInstallerCLICore/Workflows/FontFlow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/AppInstallerCLICore/Workflows/FontFlow.cpp b/src/AppInstallerCLICore/Workflows/FontFlow.cpp index 88765b97ce..87fb26682b 100644 --- a/src/AppInstallerCLICore/Workflows/FontFlow.cpp +++ b/src/AppInstallerCLICore/Workflows/FontFlow.cpp @@ -315,6 +315,12 @@ namespace AppInstaller::CLI::Workflow fontContext.Scope = scope; } + if (fontContext.Scope == Manifest::ScopeEnum::Machine && !Runtime::IsRunningAsAdmin()) + { + context.Reporter.Error() << Resource::String::CommandRequiresAdmin << std::endl; + AICLI_TERMINATE_CONTEXT(APPINSTALLER_CLI_ERROR_COMMAND_REQUIRES_ADMIN); + } + auto uninstallResult = Fonts::UninstallFontPackage(fontContext); if (uninstallResult.Result() != FontResult::Success) {