From c489e7a138e2a158310f2f0ef97d83fd94f9490f Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 18 Dec 2021 08:41:06 -0500 Subject: [PATCH] Add allowed app to Controlled Folder Access in Windows installer. --- installer.nsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/installer.nsi b/installer.nsi index 412d779a..56ff812d 100644 --- a/installer.nsi +++ b/installer.nsi @@ -107,6 +107,10 @@ Section "${NAME}" INSTALL_SECTION ; Create shortcuts CreateShortcut "$DESKTOP\${NAME}.lnk" "$INSTDIR\Rack.exe" CreateShortcut "$SMPROGRAMS\${NAME}.lnk" "$INSTDIR\Rack.exe" + + ; Add allowed app to Controlled Folder Access + ExpandEnvStrings $0 "%COMSPEC%" + ExecShellWait "" '"$0"' "/C powershell -ExecutionPolicy Bypass -WindowStyle Hidden $\"Add-MpPreference -ControlledFolderAccessAllowedApplications '$INSTDIR\Rack.exe'$\"" SW_HIDE SectionEnd