This error can occur in the following cases

Case 1: NetSim application not having sufficient previliges

Also make sure that you run NetSim in Admin mode, by right-clicking on the NetSim shortcut icon in the desktop and selecting Run as Administrator

Case 2: When interfacing with MATLAB

Make sure that the following directory is in the environment variable PATH: 

<Path where MATLAB is installed>\bin\win32

For eg: "C:\Program Files (x86)\MATLAB\R2019b\bin\win32"

By default, only the path till the bin folder of MATLAB will get added to the path variable. i.e 

"C:\Program Files (x86)\MATLAB\R2019b\bin"