Last active
June 1, 2025 17:31
-
-
Save griffeth-barker/8d9d883a2429da671d3f7b5094217d6b to your computer and use it in GitHub Desktop.
Uninstall Windows Copilot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Uninstall-WindowsCopilot { | |
<# | |
.SYNOPSIS | |
Uninstalls Windows Copilot. | |
.DESCRIPTION | |
This function uninstalls the new Windows Copilot package. | |
.PARAMETER Scope | |
Specifies the scope of the uninstallation. Valid values are "CurrentUser" or "AllUsers". Default is "CurrentUser". | |
Required : false | |
Type : string | |
Position : 0 | |
.EXAMPLE | |
# Uninstall Windows Copilot | |
Uninstall-WindowsCopilot | |
.NOTES | |
This will not remove the "Copilot for Microsoft 365" package as it is bundled with Microsoft 365. | |
Requirements: | |
- Operating System(s): | |
- "Windows" | |
- Package(s): | |
- "PowerShell" | |
- Permission(s): | |
- "Administrator" | |
License: | |
This function is released under the MIT License. | |
https://choosealicense.com/licenses/mit/ | |
.LINK | |
https://gist.github.com/griffeth-barker/8d9d883a2429da671d3f7b5094217d6b | |
#> | |
#Requires -RunAsAdministrator | |
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] | |
param ( | |
[Parameter(Mandatory = $false, Position = 0, ValueFromPipeline = $false)] | |
[ValidateSet("CurrentUser", "AllUsers")] | |
[string] | |
$Scope = "CurrentUser" | |
) | |
begin { | |
$packageFullName = Get-AppxPackage -Name "*Copilot*" | |
Write-Debug "Found packages:" | |
Write-Debug "$($packageFullName.PackageFullName -join ',' | Format-List)" | |
} | |
process { | |
if ($PSCmdlet.ShouldProcess("Windows Copilot package $($packageFullName).PackageFullName", "Uninstall")) { | |
if ($Scope -eq "CurrentUser") { | |
Write-Information "Uninstalling Windows Copilot for current user..." -InformationAction Continue | |
Get-AppxPackage -Name "*Copilot*" | ForEach-Object { | |
try { | |
Remove-AppxPackage -Package $_ -ErrorAction Stop | |
} | |
catch { | |
Write-Error "$($_.Exception.Message)" | |
} | |
} | |
} | |
if ($Scope -eq "AllUsers") { | |
Write-Information "Uninstalling Windows Copilot for all users..." -InformationAction Continue | |
Get-AppxPackage -Name "*Copilot*" -AllUsers | ForEach-Object { | |
try { | |
Remove-AppxPackage -Package $_ -AllUsers -ErrorAction Stop | |
} | |
catch { | |
Write-Error "$($_.Exception.Message)" | |
} | |
} | |
} | |
} | |
} | |
end {} | |
} | |
# Optionally, you can uncomment one of the following lines to run the function immediately. | |
# This was functionalized for portability and reusability. | |
# Uninstall-WindowsCopilot -Scope "CurrentUser" | |
# Uninstall-WindowsCopilot -Scope "AllUsers" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment