The error message "This program is blocked by group policy" typically indicates that your system's group policy settings are restricting certain actions or applications. This is common in environments managed by IT departments, such as corporate or educational institutions. Here are some troubleshooting steps you can take to resolve this issue:
1) Contact your system administrator
The first step is to contact your system administrator or IT department. They have the necessary permissions to modify group policies, can go through the points below with you, and can provide a solution tailored to your organization's policies.
2) Change your working folder
On some systems, security policies may restrict the execution of files on a per-folder basis. For example, files in C:\Temp may be treated with particular suspicion. As a troubleshooting step, try placing your project files in a different working directory, such as a folder under C:\Users\<user>\Documents. Work with your IT department to determine which folder locations can safely be used for workflows that invoke binaries or batch files, or provide an exception to this particular group policy restriction.
3) Run MATLAB as administrator
Running MATLAB as an administrator can be used to determine if the issue is related to permissions.
NOTE: This should be used only as a diagnostic step and is not recommended as a permanent workaround.
4) Check group policy settings
If you have administrative rights on your computer, you can check and modify group policy settings:
- Press the Windows + R keys to open the Run dialog. Then you should type gpedit and click OK to open the Group Policy window.
- Expand User Configuration > Administrative Templates > System. In the right pane, navigate to Don’t run specified Windows applications and double-click it.
- Then click the Show button. Ensure that MATLAB and related binaries (e.g., compilers), as well as specific folders (such as the Windows Temp, and MATLAB/Simulink codegen and cache folders), are not blocked.
- Remove the target program or application from the disallowed list and click OK.
5) Check Antivirus and Firewalls
Sometimes antivirus software can interfere with execution. Ensure that MATLAB and related binaries (e.g., compilers) and batch files are allowed in your antivirus software. Also, check if Windows Defender or any other security software is blocking the execution of MATLAB-related processes.
Note that, for example, the MinGW compilers are usually installed in the C:\ProgramData directory, not the MATLAB installation folder itself.
6) Modify Temp Folder Permissions and Location
If the error message points to a file located in the Windows Temporary folder, check that your account has "Full Control" on the C:\Users\<user>\AppData\Local\Temp folder.
If this doesn't help, change the Temp folder location to a safe directory. Run these commands in MATLAB:
setenv('TMP', <path to a safe location>)
clear tempdir
Note that "setenv" changes the Temp directory for the current MATLAB session only and does not affect other applications or system-wide environment variables. After changing the Temp directory, rerun your workflow to confirm the workaround. To automate the execution of the above commands, place them in a startup.m script and add it to your MATLAB path, such as the MATLAB userpath. 7) Reinstall MATLAB/Simulink
In some scenarios, especially if the administrator privileges on your Windows account have changed, reinstalling MATLAB/Simulink can help. If MATLAB was initially installed when you had administrator privileges, it might continue to assume it has certain permissions even after those privileges have been revoked. A reinstallation can potentially resolve this issue by updating the permissions.