I think more information is necessary to see what the issue might be.
1. Are you able to see the com port in NI-MAX after you?
2. If not, are you able to see the device in the windows device manager?
3. What device are you using specifically?
4. What communication protocol are you using?
5. What do you mean when you say switch something on and off?