{"id":371,"date":"2009-07-20T21:09:22","date_gmt":"2009-07-20T13:09:22","guid":{"rendered":"http:\/\/www.jhouseconsulting.com\/?p=371"},"modified":"2009-11-29T09:51:26","modified_gmt":"2009-11-29T01:51:26","slug":"locking-a-virtual-desktop-session","status":"publish","type":"post","link":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2009\/07\/20\/locking-a-virtual-desktop-session-371","title":{"rendered":"Locking a Virtual Desktop Session"},"content":{"rendered":"<p>How to lock a remote VMware View session? I&#8217;ve had mixed results getting a consistent method for locking VDI workstation sessions using VMware View across different client types, so have endeavored to document all possible methods to help come up with a best practice.<\/p>\n<p><strong>Updated 4th September 2009: <a href=\"http:\/\/www.vmware.com\/support\/viewmanager3\/doc\/releasenotes_viewmanager312.html\" target=\"_blank\">As per Resolved Issues in VMware View Manager 3.1.2<\/a><\/strong><\/p>\n<p><strong>&#8220;In full-screen mode Windows special key combinations are not redirected to virtual desktops<br \/>\nIn full-screen mode, View Client does not redirect Windows special key combinations (Windows+<key><\/key><key><\/key>) to the remote desktop. This issue is inconsistent with the direct RDP. The issue is resolved in this release.&#8221;<!--more--><\/strong><\/p>\n<p>From a Wyse Thin Client:<\/p>\n<ol>\n<li>Windows + L key<\/li>\n<li>CTRL + ALT + DEL<\/li>\n<li>Select &#8220;Windows Security&#8221; from the Start Menu and then Lock Computer<\/li>\n<li>Type the command: &#8220;rundll32 user32.dll,LockWorkStation&#8221;<\/li>\n<\/ol>\n<p>From a Windows XP and Vista Client:<\/p>\n<ol>\n<li>CTRL + ALT + INSERT and then Lock Computer<\/li>\n<li>Select &#8220;Windows Security&#8221; from the Start Menu and then Lock Computer<\/li>\n<li>Type the command: &#8220;rundll32 user32.dll,LockWorkStation&#8221;<\/li>\n<\/ol>\n<p>To be able to use the &#8220;Windows Security&#8221; method, ensure that the following Group Policy setting is Disabled.<br \/>\nComputer Configuration > Administrative Templates > Windows Components > Terminal Services > Remove Windows Security item from Start menu<\/p>\n<p>To implement the rundll32 command&#8230;<\/p>\n<ul>\n<li>Create a Shortcut called &#8220;Lock Workstation&#8221;, giving it the command line of: rundll32 user32.dll,LockWorkStation<\/li>\n<li>Change the shortcut Icon to point to C:\\WINDOWS\\system32\\shell32.dll,which contains a padlock<\/li>\n<li>You can also give this shortcut a hotkey, such as CTRL + ALT + L<\/li>\n<\/ul>\n<p>Using a custom Hotkey:<\/p>\n<ul>\n<li>Hotkey mappings are only useable if the shortcut is located on the Desktop or in the Start Menu hierarchy.<\/li>\n<li>The hotkey combination MUST start with CTRL + ALT.<\/li>\n<li>Interestingly enough, when using the VMware View Client I could only get the hotkey mappings to work when the shortcut is placed on the All Users Desktop, but the shortcut itself works from anywhere.<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2009\/07\/lockworkstation1.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-388\" title=\"lockworkstation1\" src=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2009\/07\/lockworkstation1.png\" alt=\"\" width=\"762\" height=\"538\" srcset=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2009\/07\/lockworkstation1.png 762w, https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-content\/uploads\/2009\/07\/lockworkstation1-300x212.png 300w\" sizes=\"(max-width: 762px) 100vw, 762px\" \/><\/a><\/p>\n<p>Implement the following VBScript as a Startup Script via the the following Group Policy setting:<\/p>\n<p>Computer Configuration > Windows Settings > Scripts (Startup\/Shutdown) > Startup<\/p>\n<p><dirtycode:LockWorkstation.vbs><br \/>\nOption Explicit<\/p>\n<p>Dim strShortcutLocation<br \/>\n&#8216;<br \/>\n&#8216; Set the location of the shortcut:<br \/>\n&#8216;   AllUsersStartMenu = All Users Start Menu<br \/>\n&#8216;   AllUsersDesktop = All Users Desktop<br \/>\n&#8216;   MyStartMenu = The Users&#8217; Start Menu<br \/>\n&#8216;   MyDesktop = The Users&#8217; Desktop<br \/>\n&#8216;<br \/>\nstrShortcutLocation = &#8220;AllUsersDesktop&#8221;<br \/>\nCall CreateShortcut(strShortcutLocation)<\/p>\n<p>strShortcutLocation = &#8220;AllUsersStartMenu&#8221;<br \/>\nCall CreateShortcut(strShortcutLocation)<\/p>\n<p>WScript.Quit(0)<\/p>\n<p>Sub CreateShortcut(strShortcutLocation)<\/p>\n<p>  Dim objShell, objShtCut, strSystemRoot, blnCreateShortcut<\/p>\n<p>  Set objShell = WScript.CreateObject(&#8220;WScript.Shell&#8221;)<br \/>\n  blnCreateShortcut = True<\/p>\n<p>  Select Case lcase(strShortcutLocation)<br \/>\n    Case lcase(&#8220;AllUsersStartMenu&#8221;)<br \/>\n      strShortcutLocation = objShell.SpecialFolders(&#8220;AllUsersStartMenu&#8221;)<br \/>\n    Case lcase(&#8220;AllUsersDesktop&#8221;)<br \/>\n      strShortcutLocation = objShell.SpecialFolders(&#8220;AllUsersDesktop&#8221;)<br \/>\n    Case lcase(&#8220;MyStartMenu&#8221;)<br \/>\n      strShortcutLocation = objShell.SpecialFolders(&#8220;StartMenu&#8221;)<br \/>\n    Case lcase(&#8220;MyDesktop&#8221;)<br \/>\n      strShortcutLocation = objShell.SpecialFolders(&#8220;Desktop&#8221;)<br \/>\n    Case Else<br \/>\n      blnCreateShortcut = False<br \/>\n  End Select<\/p>\n<p>  If blnCreateShortcut Then<br \/>\n    strSystemRoot = objShell.ExpandEnvironmentStrings(&#8220;%SYSTEMROOT%&#8221;)<br \/>\n    Set objShtCut = objShell.CreateShortcut(strShortcutLocation &#038; &#8220;\\Lock Workstation.lnk&#8221;)<br \/>\n    objShtCut.TargetPath = strSystemRoot &#038; &#8220;\\system32\\rundll32&#8221;<br \/>\n    objShtCut.Arguments = &#8220;user32.dll,LockWorkStation&#8221;<br \/>\n    objShtCut.WorkingDirectory= strSystemRoot<br \/>\n    objShtCut.IconLocation = strSystemRoot &#038; &#8220;\\system32\\shell32.dll&#8221; &#038; &#8220;,47&#8221;<br \/>\n    objShtCut.HotKey = &#8220;CTRL+ALT+L&#8221;<br \/>\n    objShtCut.Save()<br \/>\n    Set objShtCut = Nothing<br \/>\n  End If<\/p>\n<p>  Set objShell = Nothing<\/p>\n<p>End Sub<br \/>\n<\/dirtycode><\/p>\n<p>So in conclusion I believe that providing an icon called &#8220;Lock Workstation&#8221; that can also be triggered by a common Hotkey combination, such as CTRL + ALT + L, is the best way to provide users with a consistent method for all situations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to lock a remote VMware View session? I&#8217;ve had mixed results getting a consistent method for locking VDI workstation sessions using VMware View across different client types, so have endeavored to document all possible methods to help come up with a best practice. Updated 4th September 2009: As per Resolved Issues in VMware View &#8230; <a title=\"Locking a Virtual Desktop Session\" class=\"read-more\" href=\"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/2009\/07\/20\/locking-a-virtual-desktop-session-371\" aria-label=\"Read more about Locking a Virtual Desktop Session\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[5,91],"tags":[154],"class_list":["post-371","post","type-post","status-publish","format-standard","hentry","category-scripting","category-vdi","tag-lock-workstation"],"aioseo_notices":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts\/371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/comments?post=371"}],"version-history":[{"count":27,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts\/371\/revisions"}],"predecessor-version":[{"id":375,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/posts\/371\/revisions\/375"}],"wp:attachment":[{"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/media?parent=371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/categories?post=371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jhouseconsulting.com\/jhouseconsulting\/wp-json\/wp\/v2\/tags?post=371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}