Is there any way to quickly enable/disable my headphones using a script? Basically, it should 'emulate' this functionality.
If you disable the speakers then the users will not be able to hear any kind of sound even when the speakers are plugged in.
To accomplish this follow these steps:
1) Open Control Panel (All items view)and double click the Sound icon.
2) In the Sound window you will notice the Speakers and other audio devices connected under Playback tab.
3) Now click on Speakers and then click Properties button as highlighted above.
4) In the Speaker Properties dialog box select Use this device to enable Speakers in the Device usage dropdown list at the bottom.
Select Don’t use this device to disable Speakers in the Device usage dropdown list as shown in the above figure.
5) Click Apply and then OK button
Note: Once you disable the speakers they will no more be visible on the Sound window as shown below.
Thus to view them and to enable them right click on the Sound window and select the option Show Disabled devices as shown above to view the disabled speakers. To enable them go to step 4.