Mute Audio as a Post installation Task
Does anyone know a good way to mute audio for a Windows 7 Enterprise x64 hardware agnostic Image set to OOBE using a Post Installation Task?
In another forum I found:
If $ismuted == 0 Then
Mutesound()
EndIf
Then Auto-IT was used to make it an .exe which works if the audio is not already muted, otherwise the audio is unmuted. Thank you for your help and please let me know if you have any questions.
(P.S. if anyone knows more about the above commands that may help too)
Regards,
Erik
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
rileyz
8 years ago
It doesn't look easy, I thought there would be a nice Windows API you could call.
Have a look at this post by Alexandre Jasmin, its uses PowerShell, you can integrate it with your deployment easier.
http://stackoverflow.com/questions/255419/how-can-i-mute-unmute-my-sound-from-powershell
There will probably be a VBS option as well, I'm more of a PowerShell person, hence the link, but you can use whatever you fancy.
Posted by:
StockTrader
8 years ago
There are some API you can use but if you do not want to spend time digging in the API you can follow this other approach:
When the audio is un-muted they are set to 0
- Download the last version of Process Monitor: https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx
- Capture only the registry events.
- Open you audio mixer properties
- Click on the mute
- Stop the capture and check for the RegSetValue operations
On my system I found out that to mute the audio all the ChanXXX values under this registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318}\0000\MixerSettings\eLineOutTopo\PrimaryNode001
are set to 1
When the audio is un-muted they are set to 0
So now you can start to write your script to touch that registry key
Something like this one:
Set WshShell = CreateObject("WScript.Shell")
myKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318}\0000\MixerSettings\eLineOutTopo\PrimaryNode001"
WshShell.RegWrite Chan000,1,"REG_DWORD"
WshShell.RegWrite Chan001,1,"REG_DWORD"
WshShell.RegWrite Chan002,1,"REG_DWORD"
WshShell.RegWrite Chan003,1,"REG_DWORD"
WshShell.RegWrite Chan004,1,"REG_DWORD"
WshShell.RegWrite Chan005,1,"REG_DWORD"
WshShell.RegWrite Chan006,1,"REG_DWORD"
I think that every audio device hits a different key so you need to dig a bit with Processe Monitor to find out which keys the system touches when mute the audio.
Kind regards,
Marco - StockTrader