question

LingSteven avatar image
0 Votes"
LingSteven asked LingSteven commented

Is it possible to use powershell command to enable file access option in windows settings?

Hello,

I'm developing a business UWP app for sideloading. The app will read and write to the file which is out of the App domain. For example, the file path is c:\\folder1\\1.txt

I followed the document File access permissions, and add the capability broadFileSystemAccess. After the app is deploied on my customers' machines, I need to let my customers to go to the Settings > Privacy > File system and enable the file access option for my app at first, then the app will work well.

My customers do not want to do this step(`enable file access option`) manually. They want a automatic way to do it. Is it possible to use powershell to achieve this target? or other better ways?

Thanks,
Steven

windows-server-powershellwindows-uwp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JunjieZhu-MSFT avatar image
0 Votes"
JunjieZhu-MSFT answered LingSteven commented

Hello, @LingSteven ,
Welcome to Microsoft Q&A!

You can go to Registry [Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\broadFileSystemAccess].

If you have installed your application, you can see your app's package family name.

Modify the Value Data to Allow.

You can use Powershell to set the registry.

  Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\broadFileSystemAccess\[your package family name]" -Name "Value" -Value "Allow"

264090-image.png

Thank you.


If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



image.png (34.5 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you. It worked like a charm.

0 Votes 0 ·