I want to detect if PC is playing any kind of sound.
if it isn't playing any kind of sound I can use else condition in Powershell and do whatever I need to do next.
So is there anyway to detect sound via PowerShell?
Thanks
I want to detect if PC is playing any kind of sound.
if it isn't playing any kind of sound I can use else condition in Powershell and do whatever I need to do next.
So is there anyway to detect sound via PowerShell?
Thanks
method 1...
Import-Module -Name TroubleShootingPack
Get-TroubleshootingPack C:\Windows\diagnostics\system\Audio | Invoke-TroubleshootingPack
method 2... start to reverse engineer the scripts in C:\Windows\diagnostics\system\Audio :)
P.S: You can also read in shay's blog about how to do your specific task http://scriptolog.blogspot.co.il/2007/09/playing-sounds-in-powershell.html
You're going to need to import a .net type or dll. Admittedly, the process is hit or miss and some google searching didn't turn up much, but this is the only way you'll possibly find this sort of functionality. I would suggest search through msdn documentation for .Net for something to do the job.
Once you know what class you need:
Add-Type System.Example
Or
Add-Type -Path "C:\PathtoDll\file.dll"
Then you need to either call a static method
[System.Example]::DoSomething()
Or create a new instance of the object
$object = New-Object System.Example