Skip to content

Instantly share code, notes, and snippets.

@DoubleLabyrinth
Last active January 17, 2024 03:16
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DoubleLabyrinth/ffae94cb9444bbdae1d11deeaa247310 to your computer and use it in GitHub Desktop.
Save DoubleLabyrinth/ffae94cb9444bbdae1d11deeaa247310 to your computer and use it in GitHub Desktop.
Remove mutant entry in Start: ms-resource:AppName/Text
  1. Run fix.py, a Python3 script, with SYSTEM privilege. (NOT Administrator privilege)

    More detail:

    1. If you don't have Python3, just download Python3 installer with the following links:

      Then open Python3 installer and you get the Python3 setup window. Make sure to check the checkbox "Add Python 3.7 to PATH" before you click on the Install button. So we don’t have to configure the PATH variable manually.

      After the installation is done, you can open Command Prompt and type python to check if succeeded. If nothing wrong, you will get a python shell looking like:

      Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
      Type "help", "copyright", "credits" or "license" for more information.
      >>>
      
    2. Now you have Python3. It's time to launch Command Prompt with SYSTEM privilege.

      • Go to here and download a tool called psexec.

      • Open Command Prompt with Administrator privilege and change current directory to directory where psexec.exe exists.

        Then type

        psexec.exe -i -s -d cmd.exe
        

        and you will get a new Command Prompt with SYSTEM privilege.

    3. In Command Prompt with SYSTEM privilege, change current directory to directory where fix.py exists and type

      fix.py
      

      to run fix.py script. If nothing wrong, the output should be

      Trigger "TRG_AFTER_UPDATE_Package_SRJournal" has been cleared.
      IsInbox of "Microsoft.Windows.HolographicFirstRun_cw5n1h2txyewy_xxxxx" has been set to 0.
      Trigger "TRG_AFTER_UPDATE_Package_SRJournal" has been restored.
      
  2. Run PowerShell with Administrator privilege. Execute the following command:

    Get-AppxPackage -all *HolographicFirstRun* | Remove-AppPackage -AllUsers

    to uninstall Microsoft.Windows.HolographicFirstRun.

  3. Reboot

  4. After reboot, kill explorer.exe and ShellExperienceHost.exe in Task Manager.

  5. Task Manager -> File -> Run new task

    Click Browse button.

    In newly-opened window, go to %localappdata%\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy and delete TempState directory.

  6. Start explorer.exe in Task Manager and you will see ms-resource:AppName/Text is gone.

import os, sqlite3
conn = sqlite3.connect(os.path.expandvars(r'%ProgramData%\Microsoft\Windows\AppRepository\StateRepository-Machine.srd'))
cursor = conn.execute(
'''
SELECT _PackageID, PackageFullName FROM main.Package
WHERE PackageFullName LIKE "Microsoft.Windows.HolographicFirstRun%";
'''
)
records_to_update = {}
for row in cursor:
records_to_update[row[0]] = row[1]
cursor = conn.execute(
'''
SELECT name, sql FROM main.sqlite_master
WHERE type = "trigger" AND tbl_name = "Package" AND name LIKE "TRG_AFTER_UPDATE%";
'''
)
triggers_backup = {}
for row in cursor:
triggers_backup[row[0]] = row[1]
# Delete update triggers for table "Package"
for TriggerName, TriggerSQL in triggers_backup.items():
conn.execute(
'''
DROP TRIGGER %s;
''' % TriggerName
)
conn.commit()
print('Trigger "%s" has been cleared.' % TriggerName)
# Set IsInbox to 0
for PackageID, PackageFullName in records_to_update.items():
conn.execute(
'''
UPDATE main.Package SET IsInbox = 0 WHERE _PackageID = %d;
''' % PackageID
)
conn.commit()
print('IsInbox of "%s" has been set to 0.' % PackageFullName)
# Restore triggers
for TriggerName, TriggerSQL in triggers_backup.items():
conn.execute(
'''
%s;
''' % TriggerSQL
)
conn.commit()
print('Trigger "%s" has been restored.' % TriggerName)
@laughey
Copy link

laughey commented Jan 14, 2020

Thanks so much - it worked for me, but not before I struggled with python a bit as "system" and not needing to delete ShellExperienceHost.exe in TM (it wasn't there/running).

Other than that, my mutant entry is now a ghost. Many thanks!

@kaizengamer
Copy link

I have a corrupted app that I cannot uninstall and it's inbox is already 0. Can the python script be modified to delete a row instead? If so, how?

@Jean20B
Copy link

Jean20B commented Nov 24, 2020

I have a corrupted app that I cannot uninstall and it's inbox is already 0. Can the python script be modified to delete a row instead? If so, how?

I have the same issue with like 20 apps, same error code but IsInbox is already 0 everywhere

@shocker6
Copy link

shocker6 commented Dec 5, 2020

hey, I have no idea what any of this stuff means but I do have the same problem. I've already installed python (don't know what it's for) I just want this ms resource: AppName off my computer can someone break this down for me, please?

@geepnozeex
Copy link

geepnozeex commented Oct 17, 2021

C:>PsExec64.exe -accepteula -s cmd.exe /c C:\Python\Python37\python.exe C:\fix.py

Traceback (most recent call last):
File "C:\fix.py", line 40, in
''' % PackageID
sqlite3.OperationalError: no such function: is_srjournal_enabled
cmd.exe exited on WIN-1VCFKOM31F9 with error code 1.

@bgiessing
Copy link

I get this error when running fix.py

Traceback (most recent call last):
File "C:\Users<user>\Downloads\fix\fix.py", line 9, in
'''
sqlite3.DatabaseError: file is encrypted or is not a database

@Mythiew
Copy link

Mythiew commented Nov 13, 2021

I get this error when running fix.py

Traceback (most recent call last):
File "C:\Users<user>\Documents\fix.py", line 37, in
conn.execute(
sqlite3.OperationalError: no such function: is_srjournal_enabled

@Mythiew
Copy link

Mythiew commented Nov 13, 2021

I get this error when running fix.py

Traceback (most recent call last): File "C:\Users\Documents\fix.py", line 37, in conn.execute( sqlite3.OperationalError: no such function: is_srjournal_enabled

Does anyone know how to fix this?

@zuoliang
Copy link

On line 18, the trigger name should be changed from "TRG_AFTER_UPDATE%" to "TRG_AFTERUPDATE%"

@powerbroker
Copy link

powerbroker commented Nov 11, 2022

The same bug....

python.exe Appx-NonRemovable-fix.py

Traceback (most recent call last):
File "y:\DL\OS\IdIoT Enterprise LTSC x64!Tools\Appx-NonRemovable-fix.py", line 37, in
conn.execute(
sqlite3.OperationalError: no such function: is_srjournal_enabled

previous post about "TRG_AFTERUPDATE%" in line 18 works for me

@ilhan-athn7
Copy link

I have uninstalled Microsoft Edge succesfully by above fix, (with a small edit), thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment