How can I delete a folder with protection such as Windows Apps, but with batch or CMD?

If you are talking about the folder that Windows installs apps downloaded from the store you need TrustedInstaller permission.

PowerRun should do the job, try running your .bat through that program.
 
Last edited:
If you're using licensed NTLite, simply remove the unwanted Windows App(s) from Components.

Otherwise search online for the many PowerShell guides which explain using Remove-AppxPackage to remove UWP apps. Some system apps are protected and can't be removed unless you know SQLite, or scripting. This removal method is considered safe.

Using elevated permissions to remove Windows\SystemApps or Program Files\WindowsApps folders isn't recommended, because it won't unregister apps, or clean up the registry.
 
If you're using licensed NTLite, simply remove the unwanted Windows App(s) from Components.

Otherwise search online for the many PowerShell guides which explain using Remove-AppxPackage to remove UWP apps. Some system apps are protected and can't be removed unless you know SQLite, or scripting. This removal method is considered safe.

Using elevated permissions to remove Windows\SystemApps or Program Files\WindowsApps folders isn't recommended, because it won't unregister apps, or clean up the registry.
thanks for the information

I only knew SQLMAP, SQLite is new to me, I'll see if I learn to use it
 
Intriguing. I never knew MS used sqllite for anything

Where is the db located? Dying to a least dump the tape and see what lurks within
 
StateRepository-Machine (SRM), which manages the metadata for Appx packages uses SQLite. The inbox flag that blocks system app removals is located inside the DB, and must be cleared before using Remove-AppxPackage. All this information is covered by online sources.

If you're making an offline image, it's simpler to just remove the package before it gets installed. Which NTLite does for paid editions.
 
Also one more tip that can be usefull someday;

If we are talking on ISO level (not live system) and If you want to remove a certain file/folder (rather than a complete component with its traces), then you can simply open install.wim file via 7-zip and remove anything u want.
 
On a NTL loaded image i always remove the default defender signatures with following elevated CMD prompt code:

takeown /f "DRIVE:\NTLite\Temp\NLTmpMnt\Windows\WinSxS\amd64_windows-defender-am-sigs_31bf3856ad364e35_10.0.22621.1_none_1e1a89c00f5f6fa5" /r /d y
ICACLS "DRIVE:\NTLite\Temp\NLTmpMnt\Windows\WinSxS\amd64_windows-defender-am-sigs_31bf3856ad364e35_10.0.22621.1_none_1e1a89c00f5f6fa5" /grant USER:F /T

Change the bold text to your own and replace the folders for Defender signatures (Italic text) to what you want to remove witch NTL don't do.
 
Where you see DISM - my instructions is an elevated CMD prompt to clean out stuff on a loaded NTL image witch NTL dosn't.
It take about 20 minutes to make a perfect install image (for me).
 
Back
Top