Is there a way to detect sound through PowerShell?

I want to determine if the PC is playing any sound.


if it doesn't play any sound, I can use the else clause in Powershell and do whatever I need to do next.

Anyway, to detect sound through PowerShell?

thanks

+6
powershell
source share
2 answers

method 1 ...

Import-Module -Name TroubleShootingPack Get-TroubleshootingPack C:\Windows\diagnostics\system\Audio | Invoke-TroubleshootingPack 

method 2 ... start reconstructing the scripts in C: \ Windows \ diagnostics \ system \ Audio :)

PS: You can also read on the shay blog about how to accomplish your specific task http://scriptolog.blogspot.co.il/2007/09/playing-sounds-in-powershell.html

+2
source share

You will need to import the .net or dll type. Admittedly, this process is overwhelmed or skipped, and some searches have not increased much, but this is the only way to find such functionality. I would suggest looking through msdn for .Net documentation to complete this task.

Once you know which class you need:

 Add-Type System.Example 

or

 Add-Type -Path "C:\PathtoDll\file.dll" 

Then you need to either call the static method

 [System.Example]::DoSomething() 

Or create a new instance of the object

 $object = New-Object System.Example 
-one
source share

All Articles