{"id":154,"date":"2015-05-31T17:15:53","date_gmt":"2015-05-31T16:15:53","guid":{"rendered":"http:\/\/kolbi.cz\/blog\/?p=154"},"modified":"2017-12-15T17:10:18","modified_gmt":"2017-12-15T16:10:18","slug":"volume-and-mute-not-saved-in-a-citrix-xenapp-session","status":"publish","type":"post","link":"https:\/\/kolbi.cz\/blog\/2015\/05\/31\/volume-and-mute-not-saved-in-a-citrix-xenapp-session\/","title":{"rendered":"Volume and Mute not beeing saved in a XenApp or VDI Session"},"content":{"rendered":"<p><strong>UPDATE<\/strong>: Citrix obviously liked my idea and released their own tool with the same functionality.\u00a0<a href=\"https:\/\/support.citrix.com\/article\/CTX206888\">https:\/\/support.citrix.com\/article\/CTX206888<\/a>\u00a0&#8211; it just lacks the Delay Options, but the\u00a0binary does pretty much the same. oh well&#8230; i should have copyrighted it before \ud83d\ude1b<\/p>\n<p><em>i should have written this article already long time ago, but instead i just posted to some Citrix forums and gave out a link to my little tool. a few people already downloaded it and its probably used in quite some environments over the world. anyway &#8211; here comes finally a proper blog post about it.<\/em><\/p>\n<h1><span style=\"text-decoration: underline;\"><strong>the problem:<\/strong><\/span><\/h1>\n<p>since Windows Server 2008 the volume level and mute settings are not roamed anymore. this is not Citrix fault, but Microsoft decided to remove that feature and now the volume level is always set to 100% when a user logs on. even when reconnecting the audio volume gets maximized and mute disabled. this can be annoying in environments that need sound for their work. all windows versions higher than Vista do have this problem &#8211; means all Windows versions with the new audio subsystem.<\/p>\n<p>it seems, that these settings are not stored in the registry &#8211; at least i was not able to find where and all i have found were some workarounds, but never a full complete solution.<\/p>\n<p>one of my customers reported the same problem on a XenApp 6.5 and Windows 2008 R2 farm and since was not able to find a proper solution, i have coded a little tool that saves these settings in the registry and then loads them again on a login or reconnect. i have found some helpful source code online which hooked into the volume slider and from there i was able to get the actual settings.<\/p>\n<p>the principle of my tool is pretty simple: it starts when the users logs on and then it runs in the background &#8211; watching the volume settings. as soon a user touches the volume slide or enables mute, the tool will write these settings to the registry. following keys are used:<\/p>\n<p>HKEY_CURRENT_USER\\Control Panel\\Sound<br \/>\n<strong>Volume<\/strong>: the actual volume level. range: 0.000000 to\u00a01.000000<br \/>\n<strong>Mute<\/strong>: mute level on or off. value: true or false<br \/>\n<strong>ReconnectTimer<\/strong>: this is a hidden setting, where a timer will delay the audio setting restore when a user reconnects to a session (in milliseconds)<\/p>\n<p>so if your environment for some reason does need additional time to initialize the session and the volume restauration does not work, you can try to set ReconnectTimer in the registry to give it a little more time.<\/p>\n<p>the same feature is available, when you start the volume.exe &#8211; it takes a commandline parameter (time in milliseconds) and will wait the supplied time until it restores the volume from the registry settings.<\/p>\n<p>there is no GUI or configuration option &#8211; the tool just does, what it should.<\/p>\n<h1><span style=\"text-decoration: underline;\"><strong>implementation:<\/strong><\/span><\/h1>\n<p>i prefer to implement it in a windows GPO using the logon script section, but some customers used the startup folder or an existing logon script to launch it &#8211; this also seems to work fine.<\/p>\n<p><a href=\"http:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/gpo_logon_script1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-156 size-full aligncenter\" src=\"http:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/gpo_logon_script1.jpg\" alt=\"gpo_logon_script\" width=\"799\" height=\"569\" srcset=\"https:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/gpo_logon_script1.jpg 799w, https:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/gpo_logon_script1-300x214.jpg 300w\" sizes=\"auto, (max-width: 799px) 100vw, 799px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/volume_script.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-157 size-full aligncenter\" src=\"http:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/volume_script.jpg\" alt=\"volume_script\" width=\"412\" height=\"460\" srcset=\"https:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/volume_script.jpg 412w, https:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/volume_script-269x300.jpg 269w\" sizes=\"auto, (max-width: 412px) 100vw, 412px\" \/><\/a><\/p>\n<p>in this case it would wait 2 seconds until it restores the volume settings from the registry.<\/p>\n<h1><span style=\"text-decoration: underline;\"><strong>published apps:<\/strong><\/span><\/h1>\n<p>i personally never used it with published apps, but thanks to Bernd N\u00f6mer who gave a helpful tipp in the citrix forums:<\/p>\n<p><em>The only thing you should do is placing the volume.exe in the &#8220;<a href=\"http:\/\/support.citrix.com\/article\/ctx891671\" target=\"_blank\" rel=\"noopener noreferrer\">LogoffCheckSysmodules<\/a>&#8221; Reg.Key so that the volume.exe will be closed when using published Apps!<\/em><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Windows Server 2012 R2 and XenApp 7:<\/strong><\/span><\/p>\n<p>Microsoft added some questionable default setting in Server 2012 R2 and Windows 8.1 &#8211; the <a href=\"https:\/\/support.microsoft.com\/en-us\/kb\/2895815\" target=\"_blank\" rel=\"noopener noreferrer\">logon script delay<\/a>. if you dont disable this feature, the loginscript will delay 5 minutes and the volume.exe does not run properly. just disable the policy to fix that:<br \/>\n<em>Computer Configuration\\Administrative Templates\\System\\Group Policy\\Configure Logon Script Delay.<\/em><\/p>\n<p><a href=\"http:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/logon_script_delay.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-158 size-full aligncenter\" src=\"http:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/logon_script_delay.jpg\" alt=\"logon_script_delay\" width=\"663\" height=\"68\" srcset=\"https:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/logon_script_delay.jpg 663w, https:\/\/kolbi.cz\/blog\/wp-content\/uploads\/2015\/05\/logon_script_delay-300x31.jpg 300w\" sizes=\"auto, (max-width: 663px) 100vw, 663px\" \/><\/a><\/p>\n<p>thats it &#8211; now the users volume settings are all saved and restored in XenApp sessions. of course you need a roaming profile solution and save the registry keys mentioned above.<\/p>\n<h1><strong><span style=\"text-decoration: underline;\">additional info:<\/span><\/strong><\/h1>\n<p>i have tested this utility on Server 2008 R2 and Server 2012 R2, but it should work on any OS newer than Vista. you will see the volume.exe process for every user on your XenApp server &#8211; dont worry, the binary is only\u00a0188 KB and it will take about 1.6MB RAM for each user. you can of course use a seperate policy and therefore limit the instances to a group, when for example not all users in your farm use audio.<\/p>\n<p>the utility is coded in visual c++ 2010 express and is based on these\u00a0code references:<\/p>\n<p><a href=\"https:\/\/subversion.assembla.com\/svn\/snarl-audiomon\/trunk\/snarl-audiomon.cpp\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/subversion.assembla.com\/svn\/snarl-audiomon\/trunk\/snarl-audiomon.cpp<\/a><br \/>\n<a href=\"http:\/\/support.microsoft.com\/kb\/310153\/en-us\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/support.microsoft.com\/kb\/310153\/en-us<\/a><br \/>\n<a href=\"http:\/\/blogs.msdn.com\/b\/calvin_hsia\/archive\/2006\/01\/11\/511639.aspx\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/blogs.msdn.com\/b\/calvin_hsia\/archive\/2006\/01\/11\/511639.aspx<\/a><br \/>\n<a href=\"http:\/\/www.eventghost.org\/forum\/viewtopic.php?f=4&amp;t=271\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.eventghost.org\/forum\/viewtopic.php?f=4&amp;t=271<\/a><\/p>\n<h1><span style=\"text-decoration: underline;\"><strong>download:<\/strong><\/span><\/h1>\n<p>you can download the volume.exe here: <a href=\"http:\/\/www.kolbi.cz\/volume.zip\" target=\"_blank\" rel=\"noopener noreferrer\">volume<\/a>\u00a0&#8211; the SHA1 for the volume.exe is 1EA3248E541D8B7AA035BA73CCE09A46DC797351<\/p>\n<blockquote><p>if you enjoyed my work, consider donating. I would appreciate it very much!<\/p>\n<p>&nbsp;<\/p>\n<p>BTC:\u00a01G7HETp7j5dq422mTg1VNB1yph9m3eKgX1<br \/>\nLTC:\u00a0LdmnKE7SnKAzKPrs6MrrPFXskuP1qRVBcD<br \/>\nETH:\u00a00x89c83770e89ae08e856EE239e477BC758FCf3Bf8<br \/>\nXMR:\u00a047y7gzD2DmjSBhKyaxQ2C7RUpLgwzr2hYGu2Ui6NcAi2feChfVR99nhBvJPQxPqhEpRfuy9pAr5ypghETPWQ3MQGCdYSK3u<br \/>\nPayPal:\u00a0<a href=\"https:\/\/www.paypal.me\/Kolbicz\">https:\/\/www.paypal.me\/Kolbicz<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Thank you!<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>UPDATE: Citrix obviously liked my idea and released their own tool with the same functionality.\u00a0https:\/\/support.citrix.com\/article\/CTX206888\u00a0&#8211; it just lacks the Delay Options, but the\u00a0binary does pretty <a class=\"mh-excerpt-more\" href=\"https:\/\/kolbi.cz\/blog\/2015\/05\/31\/volume-and-mute-not-saved-in-a-citrix-xenapp-session\/\" title=\"Volume and Mute not beeing saved in a XenApp or VDI Session\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":468,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,6,5],"tags":[],"class_list":["post-154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-citrix","category-windows","category-xenapp"],"_links":{"self":[{"href":"https:\/\/kolbi.cz\/blog\/wp-json\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kolbi.cz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kolbi.cz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kolbi.cz\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kolbi.cz\/blog\/wp-json\/wp\/v2\/comments?post=154"}],"version-history":[{"count":15,"href":"https:\/\/kolbi.cz\/blog\/wp-json\/wp\/v2\/posts\/154\/revisions"}],"predecessor-version":[{"id":345,"href":"https:\/\/kolbi.cz\/blog\/wp-json\/wp\/v2\/posts\/154\/revisions\/345"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kolbi.cz\/blog\/wp-json\/wp\/v2\/media\/468"}],"wp:attachment":[{"href":"https:\/\/kolbi.cz\/blog\/wp-json\/wp\/v2\/media?parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kolbi.cz\/blog\/wp-json\/wp\/v2\/categories?post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kolbi.cz\/blog\/wp-json\/wp\/v2\/tags?post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}