VMware Horizon Community
SummaCollege
Hot Shot
Hot Shot
Jump to solution

Audio Volume control using UEM + set default other then 100%

A few of our VDI users are complaining about UEM not saving there adjusted audio volume. I have not yet found a way to save this using UEM, is this even possible?

Besides that, the same users are also complaining about the default volume level being set to 100% every morning (floating desktops). Does someone have any tips about changing this in our golden image?

1 Solution

Accepted Solutions
DEMdev
VMware Employee
VMware Employee
Jump to solution

Hi SummaCollege​,

These settings don't live in the registry or elsewhere in the user profile, at least not in a way that can be easily managed with UEM.

What's been suggested on the forum and in some blog posts, is using some third-party tool that can save and restore sound settings to/from a file, and then use UEM to run that tool at logon and logoff, and also to persist and restore the tool's settings file.

One such tool is http://www.nirsoft.net/utils/sound_volume_view.html, which supports /SaveProfile and /LoadProfile arguments. If you create a UEM logon task (be sure to keep it at the default After profile archive import setting) to run Your/Path/To/SoundVolumeView.exe /LoadProfile "%LOCALAPPDATA%\SoundProfile.spr", create a UEM logoff task (set to Before profile archive export) with ... /SaveProfile ..., and create a Flex config file with [IncludeFiles] <LocalAppData>\SoundProfile.spr, that should do the trick.

View solution in original post

23 Replies
DEMdev
VMware Employee
VMware Employee
Jump to solution

Hi SummaCollege​,

These settings don't live in the registry or elsewhere in the user profile, at least not in a way that can be easily managed with UEM.

What's been suggested on the forum and in some blog posts, is using some third-party tool that can save and restore sound settings to/from a file, and then use UEM to run that tool at logon and logoff, and also to persist and restore the tool's settings file.

One such tool is http://www.nirsoft.net/utils/sound_volume_view.html, which supports /SaveProfile and /LoadProfile arguments. If you create a UEM logon task (be sure to keep it at the default After profile archive import setting) to run Your/Path/To/SoundVolumeView.exe /LoadProfile "%LOCALAPPDATA%\SoundProfile.spr", create a UEM logoff task (set to Before profile archive export) with ... /SaveProfile ..., and create a Flex config file with [IncludeFiles] <LocalAppData>\SoundProfile.spr, that should do the trick.

SummaCollege
Hot Shot
Hot Shot
Jump to solution

Thx UEMdev​!

I tried this and your solution seems to work fine, but i am not allowed to use these kind of 3th party tools from our security officer and team manager. If it's not possible using oem vendor tools then that's a fact and we (and our users) have to deal with it. I don't necessarily agree with them but it's something i can't change (at least not yet Smiley Wink)

Reply
0 Kudos
SummaCollege
Hot Shot
Hot Shot
Jump to solution

UEMdev

Have found another (untested by me) possible solution at the following website: audio - Windows 10 registry setting for volume control - Super User

It's a Powershell script that you can use as a loginscript.

The last line is the only part you would need to edit to change volume levels.

For example [audio]::Volume = 0.5 or [audio]::Volume = 0.75 for 50% or 75%, respectively.

You can also mute or un-mute the speakers with [audio]::Mute = $true or [audio]::Mute = $false

Save this as a .ps1 file and use Group Policy to set it as a login script.

Add-Type -TypeDefinition @'

using System.Runtime.InteropServices;
[Guid("5CDF2C82-841E-4546-9722-0CF74078229A"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IAudioEndpointVolume {
  // f(), g(), ... are unused COM method slots. Define these if you care
  int f(); int g(); int h(); int i();
  int SetMasterVolumeLevelScalar(float fLevel, System.Guid pguidEventContext);
  int j();
  int GetMasterVolumeLevelScalar(out float pfLevel);
  int k(); int l(); int m(); int n();
  int SetMute([MarshalAs(UnmanagedType.Bool)] bool bMute, System.Guid pguidEventContext);
  int GetMute(out bool pbMute);
}
[Guid("D666063F-1587-4E43-81F1-B948E807363F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IMMDevice {
  int Activate(ref System.Guid id, int clsCtx, int activationParams, out IAudioEndpointVolume aev);
}
[Guid("A95664D2-9614-4F35-A746-DE8DB63617E6"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
interface IMMDeviceEnumerator {
  int f(); // Unused
  int GetDefaultAudioEndpoint(int dataFlow, int role, out IMMDevice endpoint);
}
[ComImport, Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")] class MMDeviceEnumeratorComObject { }
public class Audio {
  static IAudioEndpointVolume Vol() {
  var enumerator = new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator;
  IMMDevice dev = null;
  Marshal.ThrowExceptionForHR(enumerator.GetDefaultAudioEndpoint(/*eRender*/ 0, /*eMultimedia*/ 1, out dev));
  IAudioEndpointVolume epv = null;
  var epvid = typeof(IAudioEndpointVolume).GUID;
  Marshal.ThrowExceptionForHR(dev.Activate(ref epvid, /*CLSCTX_ALL*/ 23, 0, out epv));
  return epv;
  }
  public static float Volume {
  get {float v = -1; Marshal.ThrowExceptionForHR(Vol().GetMasterVolumeLevelScalar(out v)); return v;}
  set {Marshal.ThrowExceptionForHR(Vol().SetMasterVolumeLevelScalar(value, System.Guid.Empty));}
  }
  public static bool Mute {
  get { bool mute; Marshal.ThrowExceptionForHR(Vol().GetMute(out mute)); return mute; }
  set { Marshal.ThrowExceptionForHR(Vol().SetMute(value, System.Guid.Empty)); }
  }
}

'@

[audio]::Volume = 0.25

LukaszDziwisz
Hot Shot
Hot Shot
Jump to solution

I have noticed that if you RDP to your master image and set the volume to any desired level it will always revert back to 100 but if you Direct Connect to your image through Horizon Client it will retain whatever volume you set on your image and every new session/new clone will retain that level

FlowDE
Contributor
Contributor
Jump to solution

Hello DEMdev,

it looks like the tool works fine but i can't choose a USB Mircrophone per default and also the Volume of those USB Device won't get saved whit the 3rd Party tool. Do you got a solution for externel Devices like Philips Speech Mike 3

Greetings

Justin

Reply
0 Kudos
FlowDE
Contributor
Contributor
Jump to solution

Hello, everybody,

no one has had the problem with the USB mike yet?

Regards

Justin

Reply
0 Kudos
DEMdev
VMware Employee
VMware Employee
Jump to solution

Hi Justin,

I just tried this with my USB headset, and it seems to work just fine:

  1. I saved the current settings with SoundVolumeView.exe using the /SaveProfile argument.
  2. I made note of the current volume, and then changed it.
  3. Loaded the settings using the /LoadProfile argument, and validated that the volume was correctly restored to the value I saw in step #2.
Reply
0 Kudos
FlowDE
Contributor
Contributor
Jump to solution

Hi DEMdev,

thank your for your reply.

the configurations looks like:

Logontask

C:\Windows\xxx\Sound\SoundVolumeView.exe /LoadProfile "%Appdata%\SoundProfile.spr"

Run task: After profile archive import (No Conditions)

Logofftask

C:\Windows\xxx\Sound\SoundVolumeView.exe /SaveProfile "%Appdata%\SoundProfile.spr"

Run task: Before profile archive import (No Conditions)

i prefer to save the exe maybe in the same location as the Soundprofile.spr because we got a large environment whit alot of vcenters.

The Speechmike is via USB-Redirection available.

I just tested the settings again.

For the VMware Virtual Audio DevTap the volume is saved, also it remains selected as default device.(It looks like there are problems with the USB redirection.)

For the Speechmike the volume is not saved, also the audio in device of the Speechmike is not set as default.

Reply
0 Kudos
DEMdev
VMware Employee
VMware Employee
Jump to solution

Hi FlowDE,

Just to make sure: in addition to those logon and logoff tasks, you have also created a Flex config file to capture that "%Appdata%\SoundProfile.spr" file, right?

Reply
0 Kudos
FlowDE
Contributor
Contributor
Jump to solution

Hello UEMdev,

no i didn't make any exceptions in the Flexconfig file, because the file is saved in Appdata Roaming, the profiles are saved. The file also changes the timestamp and the volume is saved as described for the VMware Virtual Audio Dev TAP device.

Therefore i dont need to change  that, right?

Greetings

Justin

Reply
0 Kudos
DEMdev
VMware Employee
VMware Employee
Jump to solution

Hi Justin,

Depending on your setup, files in AppData\Roaming might be persisted via other mechanisms than DEM/UEM, of course. I didn't previously pick up on the fact that the volume for another device was kept correctly, sorry.

I'm wondering whether USB redirection might be playing a role in this. Not based on any experience, so... Smiley Happy

Is the volume of your USB device restored correctly if you manually run that C:\Windows\xxx\Sound\SoundVolumeView.exe /LoadProfile "%Appdata%\SoundProfile.spr" command after the user has logged on?

If you compare the output of two "%Appdata%\SoundProfile.spr" files from two different sessions, do they look the same? Or could it be the case that the USB device maybe gets a different ID in subsequent sessions, so the settings don't match up? Again, just guessing here...

Reply
0 Kudos
FlowDE
Contributor
Contributor
Jump to solution

Hello, Demdev,

thanks for your feedback. I could have thought of that myself, when manually loading / saving the profile the settings are loaded correctly. And also you are right that the Item-ID of the USB device changes.

Is there a solution for this?

Greeting

Justin

Reply
0 Kudos
DEMdev
VMware Employee
VMware Employee
Jump to solution

Hi Justin,

Happy to hear that we seem to be making progress!

If manually loading the settings works correctly, I guess that the changes in USB device IDs don't really matter.

I'd suggest to try changing your logon task to a shortcut in Explorer's Startup folder:

pastedImage_6.png
Make sure not to check the Run asynchronously check box.

Reply
0 Kudos
FlowDE
Contributor
Contributor
Jump to solution

Hello, Demdev,

I'm sorry, maybe I didn't say it right.

Saving / loading in the same session works, but as soon as a new machine is available (instant clone technology) manual loading does not work anymore because the ID of the USB device has changed. Thats just my assumption.

Regards

Justin

Reply
0 Kudos
DEMdev
VMware Employee
VMware Employee
Jump to solution

Hi Justin,

Too bad. I was wondering about that, but decided to start the new year optimistically and interpret your previous response in the most positive way Smiley Happy

The SoundVolumeView project files are pretty readable text files. Looking at those [ProfileItem...] sections: is there maybe some other attribute (Name, for instance) that you could use to map between IDs? That is, could you maybe create a script that exports a new project file to get the current IDs, updates a previously created file (with the user's preferred volumes) with the new device IDs, and then loads that?

Reply
0 Kudos
FlowDE
Contributor
Contributor
Jump to solution

Hi DEMdev,

this is really difficult to achieve, because depending on how many devices / programs are present, the number of "ProfileItems" in the Soundprofile.spr changes. It would be possible to make an assignment based on the device name "Speechmike", but this would require that only Speechmikes are used. And this is unfortunately not the case, unfortunately I can't think of a clear assignment.

and if I keep thinking about the problem, it won't be a permanent solution. Because with every login the virtual machine changes, but the physical host / USB device may also change. Even if we could save the settings for the physical host A, but the user would log on to a different physical host, the settings would be saved to the Soundprofiles.spr by this new host, so the settings on the first host would no longer exist.

Greetings

Justin

Reply
0 Kudos
DEMdev
VMware Employee
VMware Employee
Jump to solution

Hi Justin,

I don't think I understand your points w.r.t. the physical host, but either way, it sounds like this can't be addressed easily.

Reply
0 Kudos
FlowDE
Contributor
Contributor
Jump to solution

Well looks like no one needs to provide diffrent audio devices in VDI - the support can't help either.

Reply
0 Kudos
SummaCollege
Hot Shot
Hot Shot
Jump to solution

If the different devices all present themselve with a unique name (Make/model perhaps), you could possibly create seperate export profiles that you differentiate using Conditions. Different hardware is then individually added.

Don't know if that would work in this situation, just thinking with you...

Reply
0 Kudos