Skip to content

Instantly share code, notes, and snippets.

@tnhung2011
Last active April 21, 2026 15:02
Show Gist options
  • Select an option

  • Save tnhung2011/6e1d40a917c2819654ea16e478ae620e to your computer and use it in GitHub Desktop.

Select an option

Save tnhung2011/6e1d40a917c2819654ea16e478ae620e to your computer and use it in GitHub Desktop.
Uninstall FluentFlyout along with its certificate.
<# :
@echo off
setlocal enableextensions
:: checks for Administrator rights
:: "net session" depends on Server service, so this method is used instead
reg query HKEY_USERS\S-1-5-19\Environment /v TEMP >nul 2>nul || (
mshta vbscript:Execute("CreateObject(""Shell.Application"").ShellExecute ""%~f0"", """", """", ""runas"", 1:code close"^)
goto :eof
)
powershell -NoProfile -NoLogo "iex (${%~f0} | out-string)"
pause
goto :eof
#>
#Requires -RunAsAdministrator
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$app = Get-AppxPackage unchihugo.FluentFlyout -AllUsers -ErrorAction Stop
if ($app -eq $null) {
[Console]::Error.WriteLine("Package not found: unchihugo.FluentFlyout")
exit 1
} else {
Write-Output "Found package: unchihugo.FluentFlyout"
}
$form = New-Object System.Windows.Forms.Form
$form.Text = "Uninstall FluentFlyout"
$form.Width = 300
$form.Height = 200
$form.StartPosition = "CenterScreen"
$form.FormBorderStyle = "FixedDialog"
$form.MaximizeBox = $false
$form.MinimizeBox = $false
$form.TopMost = $true
$label1 = New-Object System.Windows.Forms.Label
$label1.Text = "Uninstall FluentFlyout"
$label1.Location = New-Object System.Drawing.Point(20, 20)
$label1.Size = New-Object System.Drawing.Size(250, 30)
$label1.TextAlign = [System.Windows.Forms.HorizontalAlignment]::Center
$form.Controls.Add($label1)
$checkbox1 = New-Object System.Windows.Forms.CheckBox
$checkbox1.Text = "Keep user settings"
$checkbox1.Location = New-Object System.Drawing.Point(20, 60)
$checkbox1.Size = New-Object System.Drawing.Size(250, 30)
$form.Controls.Add($checkbox1)
#checked? : .Checked
$button1 = New-Object System.Windows.Forms.Button
$button1.Text = "OK"
$button1.DialogResult = [System.Windows.Forms.DialogResult]::OK
$button2 = New-Object System.Windows.Forms.Button
$button2.Text = "Cancel"
$button2.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
$flowLayoutPanel1 = New-Object System.Windows.Forms.FlowLayoutPanel
$flowLayoutPanel1.Controls.Add($button2)
$flowLayoutPanel1.Controls.Add($button1)
$flowLayoutPanel1.FlowDirection = [System.Windows.Forms.FlowDirection]::RightToLeft
$flowLayoutPanel1.Size = New-Object System.Drawing.Size(($button1.Width + $button2.Width), ($button1.Height + 10))
$flowLayoutPanel1.Dock = [System.Windows.Forms.DockStyle]::Bottom
$form.Controls.Add($flowLayoutPanel1)
Write-Output "A window has appeared."
$form.AcceptButton = $button1
$form.CancelButton = $button2
$result = $form.ShowDialog()
if ($result -ne [System.Windows.Forms.DialogResult]::OK) { exit 1 }
$form.Dispose()
$loc = $app.InstallLocation
Write-Output "Stopping FluentFlyout process..."
$process = Get-Process FluentFlyout -ea SilentlyContinue
if ($process -ne $null) { $process | Stop-Process }
Write-Output "Removing package..."
$CanRemoveCert = $true
$certPath = Join-Path $loc "AppxSignature.p7x"
$thumb = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new($certPath).thumbprint
# Check error condition
if ($? -eq $false) {
[Console]::Error.WriteLine("Can't find certificate at: $certPath")
$CanRemoveCert = $false
}
$app | Remove-AppxPackage -AllUsers -ErrorAction Stop
# Microsoft Store may have removed certificate and user data, so non-terminating errors could occur
if ($CanRemoveCert) {
Write-Output "Removing associated certificate..."
Remove-Item Cert:\LocalMachine\TrustedPeople\$thumb
}
# If not "Keep user settings"
if (-not $checkbox1.Checked) {
Write-Output "Removing user data (requested)..."
if ($app.SignatureKind -eq "Store") {
$userPath = [environment]::GetFolderPath("LocalApplicationData") + "\Packages\$($app.PackageFamilyName)"
} else {
$userPath = [environment]::GetFolderPath("ApplicationData") + "\FluentFlyout"
}
Remove-Item -Recurse -Force $userPath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment