{"id":640,"date":"2023-06-20T06:42:53","date_gmt":"2023-06-20T11:42:53","guid":{"rendered":"https:\/\/blog.nukeitmike.com\/?p=640"},"modified":"2023-06-20T06:42:53","modified_gmt":"2023-06-20T11:42:53","slug":"launching-an-avd-published-app-via-command-line","status":"publish","type":"post","link":"https:\/\/blog.nukeitmike.com\/index.php\/2023\/06\/20\/launching-an-avd-published-app-via-command-line\/","title":{"rendered":"Launching an AVD Published App Via Command Line"},"content":{"rendered":"<p>We are experimenting with Azure Virtual Desktop and I have a need to launch a published application from a command line.&nbsp; I haven\u2019t found much documentation on that, and perhaps that is because I don\u2019t know where to look.<\/p>\n<p>However, I did find out a few things that might help me.&nbsp; Everyone who has the MSRDC.exe client installed, and has logged into their feed, has rdp files for all their apps.&nbsp; The RDP files are located in C:\\Users\\&lt;username&gt; AppData\\Local\\rdclientwpf\\<\/p>\n<p><\/p>\n<p><a href=\"https:\/\/i0.wp.com\/blog.nukeitmike.com\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-20-060408.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"635\" height=\"396\" title=\"Screenshot 2023-06-20 060408\" style=\"display: inline; background-image: none;\" alt=\"Screenshot 2023-06-20 060408\" src=\"https:\/\/i0.wp.com\/blog.nukeitmike.com\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-20-060408_thumb.png?resize=635%2C396&#038;ssl=1\" border=\"0\"><\/a><\/p>\n<p><\/p>\n<p>In that folder, you will see a folder for each subscription you have, plus a connectionsettings.store folder and a subscription json file.<\/p>\n<p>If you look in the uniquely named folders, you will see and ico, a png, and a rdp file for each application in that Workspace.&nbsp; While the folder names are unique per installed instance, the name for the 3 files is consistent across the environment.&nbsp; This means if you log into the the remote desktop client on 3 different machines, the folder names are different, but the files inside are identical.&nbsp; This is true even if different users sign into the workspace.<\/p>\n<p><\/p>\n<p><a href=\"https:\/\/i0.wp.com\/blog.nukeitmike.com\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-20-060041.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"665\" height=\"249\" title=\"Screenshot 2023-06-20 060041\" style=\"display: inline; background-image: none;\" alt=\"Screenshot 2023-06-20 060041\" src=\"https:\/\/i0.wp.com\/blog.nukeitmike.com\/wp-content\/uploads\/2023\/06\/Screenshot-2023-06-20-060041_thumb.png?resize=665%2C249&#038;ssl=1\" border=\"0\"><\/a><\/p>\n<p><\/p>\n<p>This doesn\u2019t exactly tell you how to launch it via a command line though.&nbsp; So, for my particular use case, I need to be able to launch a published app as a response to an trigger.&nbsp; But I don\u2019t know where the file is for each user.&nbsp; <\/p>\n<p>I could potentially create a copy of the rdp file and deploy that to a known location.&nbsp; As long as the user has access to the published app that should work.&nbsp; Or I can record the RDP name and then go look for it.&nbsp; Here is a PowerShell script to do that:<\/p>\n<p>$rdpFileName = &#8220;&lt;GUID for the app&gt;.rdp&#8221;<br \/>\n$searchpath = &#8220;$($env:USERPROFILE)\\AppData\\Local\\rdclientwpf&#8221;<br \/>\n$content = Get-ChildItem $searchpath<br \/>\nForeach ($item in $content) {<br \/>&nbsp;&nbsp;&nbsp;&nbsp; If ($item.Mode -eq &#8220;d&#8212;&#8211;&#8220;){&nbsp; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $gci = Get-ChildItem $item.FullName<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach ($_ in $gci) {<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If ($_.name -eq $rdpFileName){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Write-Host &#8220;Full Path is $($_.FullName)&#8221; <br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $launchpath = $_.FullName<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n}<br \/>\n&amp; &#8216;C:\\Program Files\\Remote Desktop\\msrdc.exe&#8217; $launchpath \/u:$($env:username)@&lt;YourUsersDomain&gt;<\/p>\n<p><\/p>\n<p>In the script, enter the guid filename for your app.&nbsp; (Note: You will have to go find it manually the first time.)&nbsp; You also need to enter the domain for the login.&nbsp; If you clear out the username parameter (\/u:\u2026), you will be prompted to login to the Workspace each time you launch the app.&nbsp; There are some other parameters you can set.&nbsp; At the time of this writing, there wasn\u2019t good documentation for them, and I didn\u2019t find them useful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are experimenting with Azure Virtual Desktop and I have a need to launch a published application from a command line.&nbsp; I haven\u2019t found much documentation on that, and perhaps that is because I don\u2019t know where to look. However, I did find out a few things that might help me.&nbsp; Everyone who has the&hellip; <a class=\"more-link\" href=\"https:\/\/blog.nukeitmike.com\/index.php\/2023\/06\/20\/launching-an-avd-published-app-via-command-line\/\">Continue reading <span class=\"screen-reader-text\">Launching an AVD Published App Via Command Line<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,17],"tags":[52,206,205,207,135],"class_list":["post-640","post","type-post","status-publish","format-standard","hentry","category-azure","category-microsoft","tag-azure","tag-azure-remote-app","tag-azure-virtual-desktop","tag-msrdc","tag-powershell","entry"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pcW544-ak","_links":{"self":[{"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/posts\/640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/comments?post=640"}],"version-history":[{"count":1,"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/posts\/640\/revisions"}],"predecessor-version":[{"id":641,"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/posts\/640\/revisions\/641"}],"wp:attachment":[{"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/media?parent=640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/categories?post=640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nukeitmike.com\/index.php\/wp-json\/wp\/v2\/tags?post=640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}