Script for adding programs to Controlled Folder

Hi, I’d need a script to allow all *.exe and *.com programs contained in a directory, to access a Windows 10 Controlled Folder. I guess a script that uses the powershell “Add-MpPreference -ControlledFolderAccessAllowedApplications” for each *.exe and *com file contained in a c:\directory. Thanks

Hi @datalink ,

Thanks for your script request. We have shared your request with our script developer to provide input.

Kind Regards,
PremJK

Hi @datalink ,

Our script developer has prepared the script, please run it and provide your feedback
https://scripts.itarian.com/frontend/web/topic/script-to-add-exe-and-com-files-to-the-controlled-folder-access

Kind Regards,
PremJK

Hi,
it works thanks but it is case sensitive. It only added .exe and .com programs written in lower case. Programs like EXEMPLE.EXE are not added. Is it possibile to make the script not case sensitive ?
Also is it possibile to add a flag to allow me to choose whether to add or remove programs from the controlled folder access list, using in that case the “Remove-MpPreference -ControlledFolderAccessAllowedApplications” powershell command ?

Thanks
Luca

Hi @datalink

sure, will share your request with our script developers and provide you with an updated script.

Kind Regards,
PremJK

Hi @datalink

Our script developer has updated the script as per your request, please check and let us know if you need any changes
https://scripts.itarian.com/frontend/web/topic/script-to-add-or-remove-exe-and-com-files-to-the-controlled-folder-access

Kind Regards,
PremJK