Forum Discussion
Issue with Windows Defender on Windows 11
- Aug 07, 2021I had this problem on all machines updated from 19043.1151 to 22000.120.
This command from elevated PowerShell fixed the problem for me, try it and report the results:
Get-AppxPackage Microsoft.SecHealthUI -AllUsers | Reset-AppxPackage
Step 1. While logged into Windows as my regular user, I started PowerShell 7 (x64) in Administrator code and ran these two commands:
Set-ExecutionPolicy Unrestricted
Get-AppxPackage Microsoft.SecHealthUI -AllUsers
The second command showed a bunch of information, including the InstallLocation.
Step 2. I started PowerShell 7 (x64) in regular mode, so that it ran as my regular user. I entered a command like this, where InstallLocation was the value from Step 1, above:
add-appxpackage -disabledevelopmentmode -register ('InstallLocation\AppxManifest.xml')
This was the exact text of my command; yours may vary:
add-appxpackage -disabledevelopmentmode -register ('C:\Program Files\WindowsApps\Microsoft.SecHealthUI_1000.22000.1.0_neutral__8wekyb3d8bbwe\AppxManifest.xml')
That fixed the problem. By the way, once it was fixed, the command "Get-AppxPackage Microsoft.SecHealthUI -AllUsers" showed both my usernames in its PackageUserInformation value.
- mixed_reviewsJan 22, 2024Copper ContributorThis still works in Jan 2024! Thank you so much!
- Alright580Jan 15, 2024Copper Contributor
I tried those commands in powershell and it said my access was denied and tried the Get App command and it said Get App not a recognized as this
Get-AppxPackage : Access is denied.
Access is denied.
At line:1 char:1
+ Get-AppxPackage Microsoft.SecHealthUI -AllUsers
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AppxPackage], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.Windows.Appx.PackageManager.Commands.GetApp
xPackageCommand - MoBowen1225Jan 12, 2024Copper Contributor
My microsoft Windows defender is not working I have tried multiple suggestions using powershell commands to get it working again but NONE of them work for me
Please help me
- nhenrick15Jun 01, 2022Copper Contributor
Rebecca_Harshbarger Lifesaver
- VincpelizeMay 24, 2022Copper Contributor
Rebecca_Harshbarger Finally! Thank you so much! Best solution out here 😉
- ak2766Apr 06, 2022Copper Contributor
This was the only one that worked for for my Windows 21H2 (OS Build 22000.593). The key was running the command as the logged on user and not as administrator.
I doubt I can say thank you enough. I read through all posts running each new command suggested to no avail - but I had hope it would eventually be solved.
Thank you again.UPDATE: For those that go right to the end of a long post, here's a recap of Rebecca Harshbarger's post.
Note: This is for those that do not run their computers with an account with admin privileges. In other words, if you need to enter both a username and a password when prompted for credentials if running commands as administrator, then this is for you.
First: run the command below via an elevated PowerShell:
PS C:\WINDOWS\system32> Set-ExecutionPolicy Unrestricted PS C:\WINDOWS\system32> Get-AppxPackage Microsoft.SecHealthUI -AllUsers Name : Microsoft.SecHealthUI Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US Architecture : X64 ResourceId : Version : 1000.22581.1.0 PackageFullName : Microsoft.SecHealthUI_1000.22581.1.0_x64__8wekyb3d8bbwe InstallLocation : C:\Program Files\WindowsApps\Microsoft.SecHealthUI_1000.22581.1.0_x64__8wekyb3d8bbwe IsFramework : False PackageFamilyName : Microsoft.SecHealthUI_8wekyb3d8bbwe PublisherId : 8wekyb3d8bbwe PackageUserInformation : {S-1-5-21-3853775740-655389605-3070002155-1005 [admin]: Installed} IsResourcePackage : False IsBundle : False IsDevelopmentMode : False NonRemovable : True Dependencies : {Microsoft.VCLibs.140.00_14.0.30704.0_x64__8wekyb3d8bbwe, Microsoft.UI.Xaml.2.4_2.42007.9001.0_x64__8wekyb3d8bbwe} IsPartiallyStaged : False SignatureKind : Store Status : Ok
NOTE: If the PackageUserInformation doesn't list your username, then you'll need to continue to the next step below. If your account is listed and you are stil unable to launch the Windows Security dialog, then you'll have to wait for another solution.
Copy the InstallLocation of the SecHealthUI executable - for me this is:
...
C:\Program Files\WindowsApps\Microsoft.SecHealthUI_1000.22581.1.0_x64__8wekyb3d8bbwe
...Next: Launch another PowerShell window WITHOUT electing to run as administrator, then execute the following commands:
add-appxpackage -disabledevelopmentmode -register ('C:\Program Files\WindowsApps\Microsoft.SecHealthUI_1000.22581.1.0_x64__8wekyb3d8bbwe\AppxManifest.xml')
Now back to the elevated PowerShell, run the following command:
Get-AppxPackage Microsoft.SecHealthUI -AllUsers
NOTE: Make sure that PackageUserInformation now lists your user account.
You should now be able to launch the Windows defender UI without that very annoying message.
- WHowoeApr 27, 2022Copper ContributorI don't know how to express my gratitude to you. I tried to solve this problem for about 10 days. And this is the only working solution for me. I will remember for a long time how "The man on the forum literally saved my life" haha. Thank you
- jdsteel7Apr 25, 2022Copper ContributorThis worked for me!! Thank you! The problem was that my admin account worked fine with the Get-AppxPackage Microsoft.SecHealthUI -AllUsers command but my other account was not working. Your instructions solved it perfectly. Much appreciated.
- François BretonApr 11, 2022Copper ContributorThis is the right answer for me. As describe, the key for me was running the command as the logged on user and not as administrator to disable the development mode.
- Jabber00Apr 11, 2022Copper Contributor
François Breton
Can you explain better what you mean with "as the logged on user and not as administrator to disable the development mode"?
- Wayne_53Apr 05, 2022Copper ContributorThis worked thank you.
- AthloniteMar 29, 2022Copper ContributorThat worked for me thankyou very much I was getting so frustrated that defender wouldn't open and I kept getting the you'll need an ap for that msg
- hiThereSomeUserHereMar 27, 2022Copper Contributorfinally, working solution! it seems like most of users have only one account in their system, root, so they fix it with just one command. for those who have an unprivileged account for the sake of the security, it's a two steps solution. I'm glad I found your answer in the last page of this discussion. I think, it should be more available for people.
- stevemagruderMar 26, 2022Copper ContributorRebecca, yours was the solution that worked for me. Big thanks!!