Skip to content

Instantly share code, notes, and snippets.

@Delivator
Created February 7, 2019 21:13
Show Gist options
  • Save Delivator/6659746ea5f84ce39c3904030ee4fb84 to your computer and use it in GitHub Desktop.
Save Delivator/6659746ea5f84ce39c3904030ee4fb84 to your computer and use it in GitHub Desktop.
A little powershell script that sets the default microphone volume to a set value, requires nircmd.exe to be in same directory as the script
# How long it should wait between every loop in seconds
$secondsToWait = 5
# The volume you want in percent (0.92 = 92%)
$volume = 1.00
Write-Host "Starting invinite loop, press CTRL + C or close the window to stop"
while (1) {
Start-Process -FilePath "nircmd.exe" -WorkingDirectory $PSScriptRoot -ArgumentList "setsysvolume $([math]::floor(65535 * $volume))","default_record" -Wait
Write-Host "Volume set to $($volume * 100)%"
Start-Sleep -Seconds $secondsToWait
}
@Delivator
Copy link
Author

Requires nircmd.exe to be in the same directory as the script: http://www.nirsoft.net/utils/nircmd.html

@Morimx
Copy link

Morimx commented Oct 24, 2022

you literally save my life , btw for the others that need to use this i recommend running it with:

powershell.exe -windowstyle hidden -file C:\iis_test.ps1

so you doesnt need to have the powershell window open

Thank again

@Delivator
Copy link
Author

Totally forgot about this, glad it helped you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment