kkenyon

Disable the Copilot Hardware Key - Powershell

Oct 19th, 2025 (edited)
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 1.24 KB | Software | 0 0
  1. # SCRIPT TO DISABLE THE WINDOWS 11 COPILOT HARDWARE KEY
  2. # This change applies only to the current user.
  3.  
  4. $RegistryPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
  5. $ValueName = "SetCopilotHardwareKey"
  6. $ValueData = 0
  7. $ValueType = "DWord"
  8.  
  9. try {
  10.     # Check if the registry path exists. If not, create it.
  11.     if (-not (Test-Path $RegistryPath)) {
  12.         New-Item -Path $RegistryPath -Force | Out-Null
  13.         Write-Host "Created registry path: $RegistryPath" -ForegroundColor Green
  14.     }
  15.  
  16.     # Set the registry value. This creates it if it doesn't exist or overwrites it if it does.
  17.     Set-ItemProperty -Path $RegistryPath -Name $ValueName -Value $ValueData -Type $ValueType -Force
  18.  
  19.     Write-Host "Successfully set '$ValueName' to 0." -ForegroundColor Green
  20.     Write-Host "The Copilot key has been disabled for the current user: $([System.Security.Principal.WindowsIdentity]::GetCurrent().Name)"
  21.     Write-Host "---------------------------------------------------------"
  22.     Write-Host "IMPORTANT: You must restart your computer for this change to take effect." -ForegroundColor Yellow
  23.  
  24. }
  25. catch {
  26.     Write-Host "An error occurred:" -ForegroundColor Red
  27.     Write-Host $_.Exception.Message -ForegroundColor Red
  28. }
Advertisement
Add Comment
Please, Sign In to add comment