<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Disabling printer redirection for remote users only in Horizon Desktops and Apps</title>
    <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Disabling-printer-redirection-for-remote-users-only/m-p/2660918#M71248</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In case anyone is interested i managed to resolve this by using a vbs script run using the RunOnConnect option from the View agent GPO. It queries the volatile environmental variables for the name of the external access view connection servers. and if it matches it then checks group membership. If not a member of the remote-printing-allowed group it disables the thinprint services.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13763101584992724" jivemacro_uid="_13763101584992724"&gt;
&lt;P&gt;strComputer = "."&lt;/P&gt;
&lt;P&gt;Set objNetwork = WScript.CreateObject("Wscript.Network") &lt;/P&gt;
&lt;P&gt;Set objSysInfo = CreateObject("ADSystemInfo" ) &lt;/P&gt;
&lt;P&gt;strUserDN = objSysInfo.userName&lt;/P&gt;
&lt;P&gt;Set objUser = GetObject("LDAP://" &amp;amp; strUserDN)&lt;/P&gt;
&lt;P&gt;Set objWMIService = GetObject("winmgmts:\\" &amp;amp; strComputer &amp;amp; "\root\cimv2")&lt;/P&gt;
&lt;P&gt;Set objShell = CreateObject("WScript.Shell")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;'--------------------------------------------------------&lt;/P&gt;
&lt;P&gt;' IsMember Function&lt;/P&gt;
&lt;P&gt;'--------------------------------------------------------&lt;/P&gt;
&lt;P&gt;Function IsMember(strGroup) &lt;/P&gt;
&lt;P&gt;' Function to test one user for group membership. &lt;/P&gt;
&lt;P&gt;' objUser is the user object with global scope. &lt;/P&gt;
&lt;P&gt;' strGroup is the NT Name of the group to test. &lt;/P&gt;
&lt;P&gt;' objGroupList is a dictionary object with global scope. &lt;/P&gt;
&lt;P&gt;' Returns True if the user is a member of the group.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Dim objGroup &lt;/P&gt;
&lt;P&gt;If IsEmpty(objGroupList) Then &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; Set objGroupList = CreateObject("Scripting.Dictionary" ) &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; objGroupList.CompareMode = vbTextCompare &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; For Each objGroup In objUser.Groups &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objGroupList(objGroup.sAMAccountName) = True &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; Next &lt;/P&gt;
&lt;P&gt;End If &lt;/P&gt;
&lt;P&gt;IsMember = objGroupList.Exists(strGroup) &lt;/P&gt;
&lt;P&gt;End Function&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;'--------------------------------------------------------&lt;/P&gt;
&lt;P&gt;' Check to see if client logged into external View Connection Servers&lt;/P&gt;
&lt;P&gt;' Disable printing if not member of AD Group remote-printing-allowed&lt;/P&gt;
&lt;P&gt;'--------------------------------------------------------&lt;/P&gt;
&lt;P&gt;If objShell.ExpandEnvironmentStrings("%ViewClient_Broker_DNS_Name%") = "GR1VCSV01.domain.net" _&lt;/P&gt;
&lt;P&gt;Or objShell.ExpandEnvironmentStrings("%ViewClient_Broker_DNS_Name%") = "GR1VCSV02.domain.net" _&lt;/P&gt;
&lt;P&gt;Then&lt;/P&gt;
&lt;P&gt;If IsMember("remote-printing-allowed") Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; echo "Virtual Printing Enabled" &lt;/P&gt;
&lt;P&gt;Else&lt;/P&gt;
&lt;P&gt;Set colServiceList = objWMIService.ExecQuery _&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ("Select * from Win32_Service where Name = 'TPAutoConnSvc' OR Name = 'TPVCGateway'")&lt;/P&gt;
&lt;P&gt;For Each objService in colServiceList&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If objService.State = "Running" Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objService.StopService()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wscript.Sleep 5000&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; errReturnCode = objService.ChangeStartMode("Disabled")&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;end if&lt;/P&gt;
&lt;P&gt;end If&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Aug 2013 12:24:01 GMT</pubDate>
    <dc:creator>MMAgeek</dc:creator>
    <dc:date>2013-08-12T12:24:01Z</dc:date>
    <item>
      <title>Disabling printer redirection for remote users only</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Disabling-printer-redirection-for-remote-users-only/m-p/2660915#M71245</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi we have a client requirement that when users connect to the View 5.2 platform internally (over PCoIP) they are able to get both printers mapped with location based printing GPO and any locally attached usb printers. However when a user works from outside the LAN the requirement is to disable all printer redirection - they do not want sensitive documents being printed from outside the office.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the best way to achieve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 17:57:18 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Disabling-printer-redirection-for-remote-users-only/m-p/2660915#M71245</guid>
      <dc:creator>MMAgeek</dc:creator>
      <dc:date>2013-07-02T17:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling printer redirection for remote users only</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Disabling-printer-redirection-for-remote-users-only/m-p/2660916#M71246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer this &lt;A href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;amp;cmd=displayKC&amp;amp;externalId=2003626" title="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;amp;cmd=displayKC&amp;amp;externalId=2003626"&gt;http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;amp;cmd=displayKC&amp;amp;externalId=2003626&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mohammed &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 21:49:15 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Disabling-printer-redirection-for-remote-users-only/m-p/2660916#M71246</guid>
      <dc:creator>memaad</dc:creator>
      <dc:date>2013-07-02T21:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling printer redirection for remote users only</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Disabling-printer-redirection-for-remote-users-only/m-p/2660917#M71247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, but that won't solve the problem - some users will use the same laptop to access the environment from both inside and outside the LAN, so we cannot ask them to change registry keys or stop services once they are working remotely. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Other users will use their home PCs but again we cannot ask them to stop services or edit registry keys - they will just change it back if they want to print something.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 07:00:39 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Disabling-printer-redirection-for-remote-users-only/m-p/2660917#M71247</guid>
      <dc:creator>MMAgeek</dc:creator>
      <dc:date>2013-07-03T07:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling printer redirection for remote users only</title>
      <link>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Disabling-printer-redirection-for-remote-users-only/m-p/2660918#M71248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In case anyone is interested i managed to resolve this by using a vbs script run using the RunOnConnect option from the View agent GPO. It queries the volatile environmental variables for the name of the external access view connection servers. and if it matches it then checks group membership. If not a member of the remote-printing-allowed group it disables the thinprint services.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13763101584992724" jivemacro_uid="_13763101584992724"&gt;
&lt;P&gt;strComputer = "."&lt;/P&gt;
&lt;P&gt;Set objNetwork = WScript.CreateObject("Wscript.Network") &lt;/P&gt;
&lt;P&gt;Set objSysInfo = CreateObject("ADSystemInfo" ) &lt;/P&gt;
&lt;P&gt;strUserDN = objSysInfo.userName&lt;/P&gt;
&lt;P&gt;Set objUser = GetObject("LDAP://" &amp;amp; strUserDN)&lt;/P&gt;
&lt;P&gt;Set objWMIService = GetObject("winmgmts:\\" &amp;amp; strComputer &amp;amp; "\root\cimv2")&lt;/P&gt;
&lt;P&gt;Set objShell = CreateObject("WScript.Shell")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;'--------------------------------------------------------&lt;/P&gt;
&lt;P&gt;' IsMember Function&lt;/P&gt;
&lt;P&gt;'--------------------------------------------------------&lt;/P&gt;
&lt;P&gt;Function IsMember(strGroup) &lt;/P&gt;
&lt;P&gt;' Function to test one user for group membership. &lt;/P&gt;
&lt;P&gt;' objUser is the user object with global scope. &lt;/P&gt;
&lt;P&gt;' strGroup is the NT Name of the group to test. &lt;/P&gt;
&lt;P&gt;' objGroupList is a dictionary object with global scope. &lt;/P&gt;
&lt;P&gt;' Returns True if the user is a member of the group.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Dim objGroup &lt;/P&gt;
&lt;P&gt;If IsEmpty(objGroupList) Then &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; Set objGroupList = CreateObject("Scripting.Dictionary" ) &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; objGroupList.CompareMode = vbTextCompare &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; For Each objGroup In objUser.Groups &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objGroupList(objGroup.sAMAccountName) = True &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; Next &lt;/P&gt;
&lt;P&gt;End If &lt;/P&gt;
&lt;P&gt;IsMember = objGroupList.Exists(strGroup) &lt;/P&gt;
&lt;P&gt;End Function&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;'--------------------------------------------------------&lt;/P&gt;
&lt;P&gt;' Check to see if client logged into external View Connection Servers&lt;/P&gt;
&lt;P&gt;' Disable printing if not member of AD Group remote-printing-allowed&lt;/P&gt;
&lt;P&gt;'--------------------------------------------------------&lt;/P&gt;
&lt;P&gt;If objShell.ExpandEnvironmentStrings("%ViewClient_Broker_DNS_Name%") = "GR1VCSV01.domain.net" _&lt;/P&gt;
&lt;P&gt;Or objShell.ExpandEnvironmentStrings("%ViewClient_Broker_DNS_Name%") = "GR1VCSV02.domain.net" _&lt;/P&gt;
&lt;P&gt;Then&lt;/P&gt;
&lt;P&gt;If IsMember("remote-printing-allowed") Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; echo "Virtual Printing Enabled" &lt;/P&gt;
&lt;P&gt;Else&lt;/P&gt;
&lt;P&gt;Set colServiceList = objWMIService.ExecQuery _&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ("Select * from Win32_Service where Name = 'TPAutoConnSvc' OR Name = 'TPVCGateway'")&lt;/P&gt;
&lt;P&gt;For Each objService in colServiceList&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If objService.State = "Running" Then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objService.StopService()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wscript.Sleep 5000&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; errReturnCode = objService.ChangeStartMode("Disabled")&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;end if&lt;/P&gt;
&lt;P&gt;end If&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Aug 2013 12:24:01 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Horizon-Desktops-and-Apps/Disabling-printer-redirection-for-remote-users-only/m-p/2660918#M71248</guid>
      <dc:creator>MMAgeek</dc:creator>
      <dc:date>2013-08-12T12:24:01Z</dc:date>
    </item>
  </channel>
</rss>

