If you want to get net wlan show profiles output no matter if it fails or not, you can use either asynchronous version of exec. The callback will have stdout set.
Or you can catch exception and get stdout from there. Something like:
let nestsh_output;
try {
netsh_output = execSync('netsh wlan show profiles');
} catch (ex) {
netsh_output = ex.stdout;