By default, apps from the Microsoft Store install on the Windows C drive. Users can move the app to another internal or external local drive if they want. If you want to prevent apps from installing on drives other than the system drive, you can disable this feature via Group Policy or Registry Editor, following the instructions below.
How to block app installation on non-system drives via Group Policy
Step 1:
Press the Windows + R key combination to open the Run window and enter the keyword gpedit.msc .

Step 2:
Display the Local Group Policy Editor interface, you access the link below.
Computer Configuration > Administrative Templates > Windows Components > App Package Deployment

Step 3:
Looking at the content next to it, double-click on the value Disable installing Windows apps on non-system volumes .

Step 4:
Display the new interface, you have the option below, click Enabled to block application installation on non-system drives.
- Not Configured: Default
- Enabled: You cannot move or install Windows applications on drives other than the system drive.
- Disabled: You can move or install Windows applications on other drives.

How to block apps on non-system drives via Registry
Step 1:
You enter the keyword regedit in the Run window and then press OK to access Registry Editor.

Step 2:
In the new interface, you access the link below.
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Appx

Step 3:
Right- click on Appx and select New > DWORD (32-bit) Value . Then name the value RestrictAppToSystemVolume and press Enter.

Step 4:
Click on the RestrictAppToSystemVolume value and enter 1 to prevent application installation on non-system drives.

If you want to restore it, just delete the RestrictAppToSystemVolume value.