How to set volume levels on Windows 10 lock/unlock
The volume mixer on Windows 10 has to be the smartest volume control that any desktop OS has to offer at present. maOS doesn’t offer anything like it but Microsoft hasn’t made any changes, or improvements to it, to date. There’s application specific volume control but that’s about it. If you want to set volume levels on Windows 10 lock/unlock, you’re going to have to jump through a few hoops but it is possible.
Windows 10 lock/unlock volume
This solution comes from Istker Auver.
You need to download a file from Github called AudioDeviceCmdlets. Move this file some place you won’t delete it. You’re going to need to enter the path to this file in the next step.
Open PowerShell and run these commands. Replace the path next to ‘Copy-Item’ with the path to the file you downloaded from Github earlier. Run each command one by one.
New-Item "$($profile | split-path)\Modules\AudioDeviceCmdlets" -Type directory -Force Copy-Item "C:\Path-to-file\AudioDeviceCmdlets.dll" "$($profile | split-path)\Modules\AudioDeviceCmdlets\AudioDeviceCmdlets.dll" Set-Location "$($profile | Split-Path)\Modules\AudioDeviceCmdlets" Get-ChildItem | Unblock-File Import-Module AudioDeviceCmdlets
Next, you need to create two PowerShell scripts. One script will set the volume when you lock your system, and the other will set the volume when you unlock it. The volume levels can be customized.
PowerShell Scripts
Open Notepad and paste the following in it.
Set-AudioDevice -PlaybackVolume 20
You can replace the 20 with whatever volume you want to lower your system’s volume to. Save it with a name that tells you what the script is for, and with the PS1 file extension.
Open another Notepad file, and paste the following in it.
Set-AudioDevice -PlaybackVolume 100
Replace the 100 with whatever volume level you want to increase the system volume to. Save the script with a name that tells you what the script is for, and save it with the PS1 extension.
Running Scripts
In order to run the scripts, you need to create scheduled tasks. Open Task scheduler and create a new task. Give it a name that tells you what the task is for, and give it a description to be safe.
The trigger for this task should be “On workstation lock”. This will run the task when you lock your system. Go to the Action tab and add a new action. The action should be set to Start a program. In the Program/script field, enter powershell, and in the argument section enter the following. Make sure you change the path to the script to match the path to the script on your system.
-ExecutionPolicy RemoteSigned -File C:\path-to-script\lower_volume.ps1
This will lower the volume when you lock your system. You now have to create a second scheduled task that will run the script for increasing the volume when you unlock your system.
Follow the same process as above but change the Trigger to ‘On workstation unlock’, and in the Action tab, select the script that you created for increased the volume.