I have a Lenovo W540 Laptop at work. Often times, when docking/undocking, the audio stops working or the audio will not play through the headphones or the On Screen Display stops working or the hotkeys don’t do the right thing. Below is a batch script I assembled that will stop all affected services and re-start them. It has worked so far, but let me know if you find a case where it does not work.
::Restart audio services and On Screen Display services
net stop AudioSrv net stop AudioEndpointBuilder net stop TPHKLOAD net stop TPHKSVC
net start AudioEndpointBuilder net start AudioSrv net start TPHKLOAD net start TPHKSVC
taskkill /F /FI "IMAGENAME eq Ravcpl*"