<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andrew Morgan &#187; RES WorkspaceManager</title>
	<atom:link href="http://andrewmorgan.ie/tag/res-workspacemanager/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrewmorgan.ie</link>
	<description>Grumpy ramblings</description>
	<lastBuildDate>Fri, 30 Jun 2017 09:24:25 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0</generator>
	<item>
		<title>Removing users access to &#8220;Devices and Printers&#8221; in a Server 2008 R2 / Win 7 Environment.</title>
		<link>http://andrewmorgan.ie/2012/01/removing-users-access-to-devices-and-printers-in-a-server-2008-r2-win-7-environment/</link>
		<comments>http://andrewmorgan.ie/2012/01/removing-users-access-to-devices-and-printers-in-a-server-2008-r2-win-7-environment/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 11:49:58 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[PowerShell Scripting]]></category>
		<category><![CDATA[Workspace Manager]]></category>
		<category><![CDATA[XenApp]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[RES Software]]></category>
		<category><![CDATA[RES WorkspaceManager]]></category>

		<guid isPermaLink="false">http://andrewmorgan.ie/?p=1312</guid>
		<description><![CDATA[I love a good challenge. Recently I read the following article from Microsoft about how to tackle the title of this blog. This hack didn&#8217;t actually stop the users from accessing the cpl as clever users will just use rundll32 to get around the limitation. This also knocked other &#8220;show the following control panel items&#8221; policies out. This really inst a huge issue to most environments, as users will probably want to enumerate their printers at one stage or another. But in a RES [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><img class="alignright" src="/wp-content/uploads/2012/01/winlogo.png?w=75&amp;h=75" alt="" width="75" height="75" />I love a good challenge. Recently I read the<a href="http://support.microsoft.com/kb/2018577" target="_blank"> following article</a> from Microsoft about how to tackle the title of this blog. This hack didn&#8217;t actually stop the users from accessing the cpl as clever users will just use rundll32 to get around the limitation. This also knocked other &#8220;show the following control panel items&#8221; policies out.</p>
<p>This really inst a huge issue to most environments, as users will probably want to enumerate their printers at one stage or another. But in a RES Workspace manager environment, RES provide a much better interface for printer management which really defunct&#8217;s and eliminates the need for the windows method.</p>
<p>The culprit can be seen below:</p>
<p><a href="/wp-content/uploads/2012/01/culprit.png"><img class="aligncenter size-full wp-image-1325" title="culprit" src="/wp-content/uploads/2012/01/culprit.png" alt="" width="411" height="149" /></a></p>
<p>This problem for me, all stems from the &#8220;<a href="http://technet.microsoft.com/en-us/library/cc938271.aspx" target="_blank">NoSetFolders</a>&#8221; chestnut, anyone who&#8217;s tried to lock down a Terminal services environment from Windows Server 2000 onwards will be aware that this <em>&#8220;handy&#8221;</em> group policy removes the users ability to use [Windows Key] and [E] to open explorer. This issue still isn&#8217;t fixed in 2008 R2 and I&#8217;m beginning to think Microsoft just wont fix it. Hey no big deal right? Yes, quite a big deal if you ask pedantic users.</p>
<p><em>Anyway</em>, I digress. Once you remove the NoSetFolders key, the user has the ability to see the devices and printers as below on the start menu, hence my situation.</p>
<p>To remove this folder view for all users, its time to hack the registry!</p>
<p>The Class ID belonging to this start menu item can be found here:</p>
<pre>HKEY_CLASSES_ROOTCLSID{A8A91A66-3A7D-4424-8D24-04E180695C7A}</pre>
<p>This dastardly key also has a 32bit relation that can be found here:</p>
<pre>HKEY_CLASSES_ROOTWow6432NodeCLSID{A8A91A66-3A7D-4424-8D24-04E180695C7A}</pre>
<p>As with my previous post about removing <a href="http://andrewmorgan.ie/2012/01/16/removing-screen-resolution-and-personalize-shell-extensions-from-a-users-desktop-session/" target="_blank">screen resolution and personalise</a>, its just a matter of removing the users ability to see this registry key.</p>
<p>So below you will find the steps to take to remove this item:</p>
<ol>
<li>Take a backup of this key, you’ll thank me if you get it wrong!</li>
<li>Browse down to HKEY_CLASSES_ROOTCLSID{A8A91A66-3A7D-4424-8D24-04E180695C7A}</li>
<li>right click this key, choose permissions, click advanced then owner</li>
<li>Select administrators from the list, then choose “Apply”.</li>
<li>browse to the permissions tab and remove the “users” group. (you may need to remove inheritance)</li>
<li>Click “apply”, then “ok”.</li>
<li>Repeat step 2 to 6 on HKEY_CLASSES_ROOTWow6432NodeCLSID{A8A91A66-3A7D-4424-8D24-04E180695C7A}</li>
<li>Tada! go grab a coffee to celebrate your domination over the windows operating system.</li>
</ol>
<p>And that&#8217;s it, even if the user tries to view the option theres a blank place on the start menu where devices and printers should be. Check back next week and I&#8217;ll show you how to replace this shell icon with PowerPrint from RES software.</p>
<p>PS: You can also quite easily script this, <a href="http://www.remkoweijnen.nl/blog/" target="_blank">Remko</a> provided me with a great script that I&#8217;ve modified below to suit this purpose.</p>
<p><span id="more-1312"></span></p>
<p>[sourcecode language=&#8221;Powershell&#8221;]</p>
<p>## #############################################################################<br />
## 	Restrict certain Explorer items via registry key.<br />
## #############################################################################<br />
if (!(get-psdrive hkcr -ea 0)){New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | out-null}</p>
<p> function get-elevatedprivileges{<br />
$definition = @&quot;<br />
    using System;<br />
    using System.Runtime.InteropServices;</p>
<p>    namespace Win32Api<br />
    {</p>
<p>       public class NtDll<br />
       {<br />
          [DllImport(&quot;ntdll.dll&quot;, EntryPoint=&quot;RtlAdjustPrivilege&quot;)]<br />
          public static extern int RtlAdjustPrivilege(ulong Privilege, bool Enable, bool CurrentThread, ref bool Enabled);<br />
       }<br />
    }<br />
&quot;@<br />
    Add-Type -TypeDefinition $definition -PassThru | out-null</p>
<p>    $bEnabled = $false</p>
<p>    # Enable SeTakeOwnershipPrivilege<br />
    $res = [Win32Api.NtDll]::RtlAdjustPrivilege(9, $true, $false, [ref]$bEnabled)<br />
}</p>
<p>function take-ownership{<br />
    param(<br />
        [Parameter(Mandatory = $true,Position = 0,valueFromPipeline=$true)]<br />
        [string]$regkey)<br />
    $key = [Microsoft.Win32.Registry]::ClassesRoot.OpenSubKey($regkey, [Microsoft.Win32.RegistryKeyPermissionCheck]::ReadWriteSubTree,[System.Security.AccessControl.RegistryRights]::takeownership)<br />
    $acl = $key.GetAccessControl()<br />
    $acl.SetOwner([System.Security.Principal.NTAccount]&quot;Administrators&quot;)</p>
<p>    #taking ownership first<br />
    $key.SetAccessControl($acl)</p>
<p>    #my bit &#8211; give admin full access<br />
    $rule = New-Object System.Security.AccessControl.RegistryAccessRule(&quot;Administrators&quot;,&quot;FullControl&quot;,&quot;allow&quot;)<br />
    $acl.addaccessrule($rule)<br />
    $key.SetAccessControl($acl)<br />
    #end bit</p>
<p>}#end ownership function.</p>
<p>function remove-useracl{<br />
     param(<br />
        [Parameter(Mandatory = $true,Position = 0,valueFromPipeline=$true)]<br />
        [string]$regkey)<br />
    write-host &quot;$regkey&quot;<br />
    #remove inheritance<br />
    $acl = Get-Acl $regkey<br />
    $acl.SetAccessRuleProtection($true, $true)<br />
    set-acl $regkey -aclobject $acl</p>
<p>    #Remove users<br />
    $acl = Get-Acl $regkey<br />
    foreach ($rule in $acl.access){if ($rule.identityreference -eq &quot;BUILTINUsers&quot;){$acl.RemoveAccessRuleSpecific($rule)}}<br />
    set-acl $regkey -AclObject $acl<br />
}#end acl function.</p>
<p>#define keys to be restricted<br />
$keys=@(&quot;CLSID{A8A91A66-3A7D-4424-8D24-04E180695C7A}&quot;, # printers and devices<br />
&quot;Wow6432NodeCLSID{A8A91A66-3A7D-4424-8D24-04E180695C7A}&quot; # 32bit Printers and devices<br />
)</p>
<p>#elevate priviledges</p>
<p>get-elevatedprivileges</p>
<p>#restrict each key<br />
foreach ($key in $keys){<br />
    if (test-path &quot;hkcr:$key&quot;){<br />
        take-ownership -regkey $key<br />
        remove-useracl -regkey &quot;hkcr:$key&quot;<br />
    }<br />
}<br />
[/sourcecode]</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2012/01/removing-users-access-to-devices-and-printers-in-a-server-2008-r2-win-7-environment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
