{"id":2297,"date":"2015-07-01T10:48:13","date_gmt":"2015-07-01T14:48:13","guid":{"rendered":"https:\/\/www.tmurgent.com\/TmBlog\/?p=2297"},"modified":"2015-07-01T11:03:12","modified_gmt":"2015-07-01T15:03:12","slug":"theglobalizer-automatically-making-user-targeted-appv-work-as-global","status":"publish","type":"post","link":"https:\/\/www.tmurgent.com\/TmBlog\/?p=2297","title":{"rendered":"TheGlobalizer: Automatically making user targeted AppV work as Global"},"content":{"rendered":"<p><img decoding=\"async\" src=\"\\Appv\\images\\Tim_before_Liftoff_400.jpg\" alt=\"Tim Speaking\" width=\"200\" align=\"left\" hspace=\"5\" \/><span style=\"font-size: small;\">A treat for you today.  You see, today is my day to find out if I am re-awarded as a Microsoft MVP. You get a little nervous waiting for Redmond to wake up and send the email each time.\u00a0So with a surprise today I find that I am no longer an App-V MVP. Now I&#8217;m a &#8220;Windows IT Pro&#8221; MVP, a category combining move. Whatever; it is my third MVP category over the years (RDS was the other). So in honor of my new recognition, today I have a new technique that IT Pros can use with App-V.<\/span><\/p>\n<p>Enjoy!<\/p>\n<p><strong>Problem Description:<\/strong><\/p>\n<p>A few of the new extensions added to App-V 5 in SP2 require global publishing to work.\u00a0 This includes some Shell Extensions, Browser Helper Objects, and Active X controls.\u00a0 Unfortunately, whether using the App-V server, Config Manager, or any other centralized distribution system we typically want to use named user based targeting rather than named machine.\u00a0\u00a0 Wouldn&#8217;t it be nice if you could target the user but get App-V to use the -global option so that you get all of the features?\u00a0 While you wouldn&#8217;t want that on a shared server (RDS) situation, it would be great for desktop\/VDI deployments.<\/p>\n<p><strong>Solution:<\/strong><\/p>\n<p>I crafted a solution using the Windows Scheduled Tasks.\u00a0 You see, scheduled tasks can run based on a lot of things other than timers.\u00a0 For example, the App-V Publishing and Reporting components use scheduled tasks that trigger on both timers and logon events.<\/p>\n<p>You can configure a scheduled task using an XML file.\u00a0 If you google even a little you can find articles on how to create a scheduled task by triggering on an event that you find in the event viewer.\u00a0 But the harder part is getting the data elements out.\u00a0 No worry, I got you covered below.<\/p>\n<p>The solution to globalizing is to trigger on an event that only fires when a user package publishing occurs.\u00a0 It turns out that the AppV Client Operational log has such an event, 1003, and the data buried in the event includes both the PackageId and VersionId elements of the package.\u00a0 So this scheduled task pulls those elements out, and then runs PowerShell to republish the same package with the -Global option.<\/p>\n<p>It is OK for a package to be published both to the user and with -global, and the effect is that the user gets the full extensions.\u00a0 [Note: There are some apps, like browser plug-ins that add toolbars and menus, where you want to clean out the internal registry entries inside the package to keep from getting double items in the browser US (but that problem already exists if you install global and publish to the user or visa versa) But you&#8217;d already be aware of that if you took our training class!].\u00a0 When a management system removes the package, the double publishing doesn&#8217;t cause a problem either &#8211; removal works even if still published.\u00a0 The global publishing does have an event also, but it is 1004 so that doesn&#8217;t trigger an endless recursion since we don&#8217;t trigger on that.<\/p>\n<p><strong>How to Use:<\/strong><\/p>\n<p>1. Copy the XML below and paste it into a file.\u00a0 It&#8217;s nice to save the file with an xml extension, but it&#8217;s ok to use something like txt.<\/p>\n<table bgcolor=\"#d0d0d8\">\n<tbody>\n<tr>\n<td>\u00a0&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-16&#8243;?&gt;&lt;Task version=&#8221;1.2&#8243; xmlns=&#8221;https:\/\/schemas.microsoft.com\/windows\/2004\/02\/mit\/task&#8221;&gt;&lt;RegistrationInfo&gt;&lt;Date&gt;2015-06-30T14:43:47.526978&lt;\/Date&gt;&lt;Author&gt;Tim Mangan&lt;\/Author&gt;&lt;Description&gt;Triggers when a per-user package publishing event occurs. It triggers a global publishing of the package on the machine, allowing extensions that require global publishing to work.&lt;\/Description&gt;&lt;\/RegistrationInfo&gt;&lt;Triggers&gt;&lt;EventTrigger&gt;<\/p>\n<p>&lt;Enabled&gt;true&lt;\/Enabled&gt;<\/p>\n<p>&lt;Subscription&gt;&amp;lt;QueryList&amp;gt;&amp;lt;Query Id=&#8221;0&#8243; Path=&#8221;Microsoft-AppV-Client\/Operational&#8221;&amp;gt;&amp;lt;Select Path=&#8221;Microsoft-AppV-Client\/Operational&#8221;&amp;gt;*[System[Provider[@Name=&#8217;Microsoft-AppV-Client&#8217;] and EventID=1003]]&amp;lt;\/Select&amp;gt;&amp;lt;\/Query&amp;gt;&amp;lt;\/QueryList&amp;gt;&lt;\/Subscription&gt;<\/p>\n<p>&lt;ValueQueries&gt;<\/p>\n<p>&lt;Value name=&#8221;ThePackageId&#8221;&gt;Event\/EventData\/Data[@Name=&#8217;Package&#8217;]&lt;\/Value&gt;<\/p>\n<p>&lt;Value name=&#8221;TheVersionId&#8221;&gt;Event\/EventData\/Data[@Name=&#8217;Version&#8217;]&lt;\/Value&gt;<\/p>\n<p>&lt;\/ValueQueries&gt;<\/p>\n<p>&lt;\/EventTrigger&gt;<\/p>\n<p>&lt;\/Triggers&gt;<\/p>\n<p>&lt;Principals&gt;<\/p>\n<p>&lt;Principal id=&#8221;Author&#8221;&gt;<\/p>\n<p>&lt;UserId&gt;S-1-5-18&lt;\/UserId&gt;<\/p>\n<p>&lt;RunLevel&gt;LeastPrivilege&lt;\/RunLevel&gt;<\/p>\n<p>&lt;\/Principal&gt;<\/p>\n<p>&lt;\/Principals&gt;<\/p>\n<p>&lt;Settings&gt;<\/p>\n<p>&lt;MultipleInstancesPolicy&gt;IgnoreNew&lt;\/MultipleInstancesPolicy&gt;<\/p>\n<p>&lt;DisallowStartIfOnBatteries&gt;false&lt;\/DisallowStartIfOnBatteries&gt;<\/p>\n<p>&lt;StopIfGoingOnBatteries&gt;false&lt;\/StopIfGoingOnBatteries&gt;<\/p>\n<p>&lt;AllowHardTerminate&gt;true&lt;\/AllowHardTerminate&gt;<\/p>\n<p>&lt;StartWhenAvailable&gt;false&lt;\/StartWhenAvailable&gt;<\/p>\n<p>&lt;RunOnlyIfNetworkAvailable&gt;false&lt;\/RunOnlyIfNetworkAvailable&gt;<\/p>\n<p>&lt;IdleSettings&gt;<\/p>\n<p>&lt;StopOnIdleEnd&gt;true&lt;\/StopOnIdleEnd&gt;<\/p>\n<p>&lt;RestartOnIdle&gt;false&lt;\/RestartOnIdle&gt;<\/p>\n<p>&lt;\/IdleSettings&gt;<\/p>\n<p>&lt;AllowStartOnDemand&gt;false&lt;\/AllowStartOnDemand&gt;<\/p>\n<p>&lt;Enabled&gt;true&lt;\/Enabled&gt;<\/p>\n<p>&lt;Hidden&gt;false&lt;\/Hidden&gt;<\/p>\n<p>&lt;RunOnlyIfIdle&gt;false&lt;\/RunOnlyIfIdle&gt;<\/p>\n<p>&lt;WakeToRun&gt;false&lt;\/WakeToRun&gt;<\/p>\n<p>&lt;ExecutionTimeLimit&gt;P3D&lt;\/ExecutionTimeLimit&gt;<\/p>\n<p>&lt;Priority&gt;7&lt;\/Priority&gt;<\/p>\n<p>&lt;\/Settings&gt;<\/p>\n<p>&lt;Actions Context=&#8221;Author&#8221;&gt;<\/p>\n<p>&lt;Exec&gt;<\/p>\n<p>&lt;Command&gt;powershell.exe&lt;\/Command&gt;<\/p>\n<p>&lt;Arguments&gt;Publish-AppVClientPackage -PackageId $(ThePackageId) -VersionId $(TheVersionId) -Global&lt;\/Arguments&gt;<\/p>\n<p>&lt;\/Exec&gt;<\/p>\n<p>&lt;\/Actions&gt;<\/p>\n<p>&lt;\/Task&gt;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>2. Run the following command as an admin to install the task:<\/p>\n<table bgcolor=\"#000040\">\n<tbody>\n<tr>\n<td><span style=\"color: #ffffff;\">schtasks \/CREATE \/RU System \/TN &#8220;Microsoft\\AppV\\Publishing\\TheGlobalizer&#8221; \/XML &#8220;C:\\path\\to\\the\\fileyousaved.xml<\/span>&#8220;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Obviously you need admin rights to add the scheduled task this way. But you can deploy this as a ConfigManager script, or just add as an AddPackage script to the DeploymentConfig.xml file of an App-V package (like the App-V Client Console package).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A treat for you today. You see, today is my day to find out if I am re-awarded as a Microsoft MVP. You get a little nervous waiting for Redmond to wake up and send the email each time.\u00a0So with a surprise today I find that I am no longer an App-V MVP. Now I&#8217;m&hellip; <a class=\"more-link\" href=\"https:\/\/www.tmurgent.com\/TmBlog\/?p=2297\">Continue reading <span class=\"screen-reader-text\">TheGlobalizer: Automatically making user targeted AppV work as Global<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[47,50],"tags":[31],"class_list":["post-2297","post","type-post","status-publish","format-standard","hentry","category-appv5","category-tools","tag-appv5","entry"],"_links":{"self":[{"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/posts\/2297","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2297"}],"version-history":[{"count":11,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/posts\/2297\/revisions"}],"predecessor-version":[{"id":2308,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=\/wp\/v2\/posts\/2297\/revisions\/2308"}],"wp:attachment":[{"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tmurgent.com\/TmBlog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}