<?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; active directory</title>
	<atom:link href="http://andrewmorgan.ie/tag/active-directory/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>Using my Citrix Edgesight Powershell module with Active directory OU&#8217;s.</title>
		<link>http://andrewmorgan.ie/2012/01/using-my-citrix-edgesight-powershell-module-with-active-directory-ous/</link>
		<comments>http://andrewmorgan.ie/2012/01/using-my-citrix-edgesight-powershell-module-with-active-directory-ous/#comments</comments>
		<pubDate>Fri, 27 Jan 2012 08:52:03 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Edgesight]]></category>
		<category><![CDATA[PowerShell Scripting]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[Citrix]]></category>
		<category><![CDATA[Egesight]]></category>
		<category><![CDATA[Micrsoft]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Quest]]></category>

		<guid isPermaLink="false">http://andrewmorgan.ie/?p=1315</guid>
		<description><![CDATA[I received a request on twitter late last night and it was an interesting one. The person in question wanted to use my current edgesight module to import users from active directory into the static Citrix Edgesight groups, but instead of group membership in Active Directory, they wanted to use Active Directory Organisational Units. All the information on how to use the module is included in the previous post, so I wont re-invent the wheel. Have a read of the previous [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><img class="alignright" src="/wp-content/uploads/2011/11/es-logo.jpg?w=112&amp;h=112" alt="" width="112" height="112" />I received a request on twitter late last night and it was an interesting one. The person in question wanted to use my current <a href="http://andrewmorgan.ie/2011/11/25/importing-users-to-citrix-edgesight-user-groups-from-active-directory/#more-1017" target="_blank">edgesight module</a> to import users from active directory into the static Citrix Edgesight groups, but instead of group membership in Active Directory, they wanted to use Active Directory Organisational Units.</p>
<p>All the information on how to use the module is included in the previous post, so I wont re-invent the wheel. Have a read of the previous post for any caveats or pre-emptive misunderstandings.</p>
<p>Below are two code snippets to use OU membership with either the Quest or Microsoft cmdlets for active directory, just modify the OU Path below, I&#8217;ve tried to include a long example to ensure there&#8217;s no confusion.</p>
<h2> Quest Active directory Snap-in:</h2>
<p>[sourcecode language=&#8221;Powershell&#8221;]<br />
#Quest Active directory module<br />
import-module &quot;C:citrix.edgesight.cmdlets.psm1&quot;<br />
add-pssnapin Quest.ActiveRoles.ADManagement<br />
$ADOU=&#8217;domain.domain.com/Country/Users/advanced/Helpdesk&#8217;<br />
$esgroupid=20</p>
<p>#clear the group before import<br />
clear-esgroupmembers -groupid $esgroupid</p>
<p>#get users from group, then import them into edgesight<br />
foreach ($user in get-QADUser -SearchRoot $ADOU -SizeLimit 0){<br />
    $prid = get-ESUserPrid $user.logonname<br />
    if ($prid -NE $null){<br />
    Add-ESGroupMember -groupid $ESgroupid -prid $prid<br />
    }<br />
}#end For<br />
[/sourcecode]</p>
<h2>Microsoft Active directory module:</h2>
<p>&nbsp;</p>
<p>[sourcecode language=&#8221;Powershell&#8221;]<br />
#Microsoft active directory module<br />
import-module &quot;C:citrix.edgesight.cmdlets.psm1&quot;<br />
import-module activedirectory<br />
$ADOU=&quot;OU=helpdesk,OU=advanced,OU=Users,OU=Country,DC=domain,DC=domain,DC=com&quot;<br />
$esgroupid=20</p>
<p>#clear the group before import<br />
clear-esgroupmembers -groupid $esgroupid</p>
<p>#get users from group, then import them into edgesight<br />
foreach ($user in get-ADUser -filter * -searchbase $ADOU){<br />
    $prid = get-ESUserPrid $user.samaccountname<br />
    if ($prid -NE $null){<br />
        Add-ESGroupMember -groupid $ESgroupid -prid $prid<br />
    }<br />
}#end For<br />
[/sourcecode]</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2012/01/using-my-citrix-edgesight-powershell-module-with-active-directory-ous/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Move objects in active directory which have been inactive for x days.</title>
		<link>http://andrewmorgan.ie/2011/12/move-objects-in-active-directory-which-have-been-inactive-for-x-days/</link>
		<comments>http://andrewmorgan.ie/2011/12/move-objects-in-active-directory-which-have-been-inactive-for-x-days/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 14:39:07 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[PowerShell Scripting]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://andrewmorgan.ie/?p=1210</guid>
		<description><![CDATA[This is just a quick script I was asked for assistance with recently. The person in question wanted to move all computers and users to defined ou&#8217;s when they were inactive for 90 days. The script is fairly self explanatory but quite scary if you get it wrong, for that reason I&#8217;ve included the -whatif parameter to show you what will happen if you overzealously just copy and paste the code. Once you are happy it works, remove the whatif [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><img class="alignright" src="/wp-content/uploads/2011/03/windows_powershell_icon.png?w=68&amp;h=68&amp;h=68" alt="" width="68" height="68" />This is just a quick script I was asked for assistance with recently. The person in question wanted to move all computers and users to defined ou&#8217;s when they were inactive for 90 days.</p>
<p>The script is fairly self explanatory but quite scary if you get it wrong, for that reason I&#8217;ve included the <strong>-whatif</strong> parameter to show you what will happen if you overzealously just copy and paste the code. Once you are happy it works, remove the whatif parameters.</p>
<p>This script relies on the powershell module for active directory, you can see if its installed as below:</p>
<p><a href="/wp-content/uploads/2011/11/rsat.png"><img class="aligncenter size-full wp-image-1216" title="rsat" src="/wp-content/uploads/2011/11/rsat.png" alt="" width="600" height="237" /></a></p>
<p style="text-align:center;"><em>I&#8217;m also aware this code is quite inefficient by searching twice, but it was the cleanest appearance I could muster to ensure the end user understands what is happening.</em></p>
<p>[sourcecode language=&#8221;Powershell&#8221;]</p>
<p>#Load the required Snapins<br />
if (!(import-module &quot;activedirectory&quot; -ea 0)) {<br />
	    Write-Host &quot;Loading active directory module.&quot; -ForegroundColor Yellow<br />
	    import-module &quot;activedirectory&quot; -ea Stop<br />
}#endif</p>
<p>#users<br />
foreach ($user in search-adaccount -UsersOnly -AccountInactive -TimeSpan 90.00:00:00){<br />
    move-adobject -identity $user.DistinguishedName -targetpath &quot;OU=Old Users,DC=some,DC=domain,dc=net&quot; -whatif<br />
}</p>
<p>#computers<br />
foreach ($computer in search-adaccount -Computersonly -AccountInactive -TimeSpan 90.00:00:00){<br />
    move-adobject -identity $computer.DistinguishedName -targetpath &quot;OU=Old Computers,DC=some,DC=domain,dc=net&quot; -whatif<br />
}<br />
[/sourcecode]</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2011/12/move-objects-in-active-directory-which-have-been-inactive-for-x-days/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importing Users to Citrix Edgesight User Groups from Active Directory.</title>
		<link>http://andrewmorgan.ie/2011/11/importing-users-to-citrix-edgesight-user-groups-from-active-directory/</link>
		<comments>http://andrewmorgan.ie/2011/11/importing-users-to-citrix-edgesight-user-groups-from-active-directory/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 15:03:25 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Citrix]]></category>
		<category><![CDATA[Edgesight]]></category>
		<category><![CDATA[PowerShell Scripting]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://andrewmorgan.ie/?p=1017</guid>
		<description><![CDATA[I&#8217;ve blogged about Edgesight reporting previously, but in this case I needed to populate Edgesight groups from active directory and keep them up to date. This functionality is (rather strangely) not available in Edgesight and for this reason I decided to create a Powershell module to allow for automation of user group population from active directory. Edgesight doesn&#8217;t seem to have any API&#8217;s or command line interfaces to hook into. For this reason my scripts are based on connecting to [&#8230;]]]></description>
				<content:encoded><![CDATA[<p><a href="/wp-content/uploads/2011/11/es-logo.jpg"><img class="alignright  wp-image-1018" title="es-logo" src="/wp-content/uploads/2011/11/es-logo.jpg" alt="" width="112" height="112" /></a>I&#8217;ve blogged about Edgesight reporting previously, but in this case I needed to populate Edgesight groups from active directory and keep them up to date. This functionality is (rather strangely) not available in Edgesight and for this reason I decided to create a Powershell module to allow for automation of user group population from active directory.</p>
<p>Edgesight doesn&#8217;t seem to have any API&#8217;s or command line interfaces to hook into. For this reason my scripts are based on connecting to the Edgesight database and retrieving the information with SQL statements. This presented a really fun challenge for me as I&#8217;m an SQL novice. I learned quite a bit in a short period of time by writing this powershell module.</p>
<p>With the following module you can run scheduled tasks to connect to your edgesight database and add / amend your user groups with ease.</p>
<p><strong>First, some caveats, warnings and limitations of Edgesight you should be aware of:</strong></p>
<ul>
<li>My SQL statements have been tested fully internally and work flawlessly, that being said <strong>Always backup your database before you attempt to use these modules.</strong></li>
<li>Each Edgesight group has a unique GUID assigned when it is created, for this reason <strong>you must manually create the Edgesight groups</strong> before attempting to import users.</li>
<li>Each user has a unique identifier in Edgesight called a PRID, if Edgesight has not seen a user before, the PRID will not exist. As such,<strong> you cannot import a user who has not logged into the environment before</strong>.</li>
</ul>
<p><code><span id="more-1017"></span><br />
</code></p>
<h2>The Module:</h2>
<p><code><br />
</code><br />
I have sealed the necessary commands for this job into a self contained module you can import on runtime.</p>
<p>The module needs to be edited by hand before you first use it. This is to specify the credentials you wish to use to connect to the Edgesight database.  I have included options for trusted connections and SQL account logins. For more information on this read the<strong> Configuring the module</strong> section below.<br />
<code><br />
</code></p>
<h2>Module Components:</h2>
<p><code></code><br />
This module has the following commands embedded to be used as part of your maintenance scripts:</p>
<p><strong>Get-ESGroups</strong></p>
<ul>
<li>Retrieves the name and ID of each Edgesight user group</li>
</ul>
<p><strong>Get-ESGroupMembers</strong></p>
<ul>
<li>Retrieves all members PRID&#8217;s of a specified user group.</li>
</ul>
<p><strong>Add-ESGoupMember</strong></p>
<ul>
<li>Ensures the user isnt already in the group.</li>
<li>Adds a specified user to a specified group.</li>
</ul>
<p><strong>Remove-ESGroupMember</strong></p>
<ul>
<li>Remove a user via their prid from a specified user group.</li>
</ul>
<p><strong>Clear-ESGroupMembers</strong></p>
<ul>
<li>Removes all members from the specified group.</li>
<li>Reports the amount of users removed.</li>
</ul>
<p><strong>Get-ESUserPrid</strong></p>
<ul>
<li>Looks up a user by name (samaccount name / login name) and returns their Prid.</li>
<li>Warns if the user doesn&#8217;t exist.</li>
</ul>
<p><strong>Get-ESUserName</strong></p>
<ul>
<li>Looks up a user by Prid and returns their login name.</li>
<li>Warns if the user doesn&#8217;t exist.</li>
</ul>
<p><code><br />
</code></p>
<h2>Dowloading the module:</h2>
<p><code><br />
</code><br />
You can download the Edgesight Module from my box.net account <a href="http://www.box.com/s/scky79u0e0tdepccyvb4" target="_blank">here</a>. Remember to continue down this blog post to see how to use the modules for your best chance of success.<br />
<code><br />
</code></p>
<h2>Configuring the module:</h2>
<p><code><br />
</code><br />
Once you have downloaded the module, you need to edit it by hand before you first use it. This is to specify the credentials you wish to use to connect to the Edgesight database.</p>
<h3>Configuring the SQL Server and database name:</h3>
<ul>
<li>Change the $SQLServer variable (labeled 1: below) to the sql database server or instance name you wish to connect to.</li>
<li>Change the $SQLDatabase variable (labeled 2: below) to the sql database name you wish to connect to.:</li>
</ul>
<p><code><br />
</code><br />
Below is an example of how this should look:</p>
<p><a href="/wp-content/uploads/2011/11/sqldetails.png"><img class="aligncenter size-full wp-image-1117" title="sqldetails" src="/wp-content/uploads/2011/11/sqldetails.png" alt="" width="568" height="91" /></a><br />
<code><br />
</code></p>
<h3>Configuring the SQL login details:</h3>
<p><code><br />
</code><br />
I have included options for<strong> trusted connections</strong> and <strong>SQL account logins</strong>. Here&#8217;s a brief description of the two options available to you when configuring your authentication for this module:</p>
<ul>
<li>A trusted connection is a connection using your logged in details.</li>
<li>A non trusted connection requires a SQL user account and password with modify rights to the edgesight database.</li>
</ul>
<h4><strong>Using a Trusted connection:</strong></h4>
<ul>
<li>Configure the $SQLTrustedConnection variable as $true</li>
<li>You can then <strong>ignore</strong> or<strong> remove</strong> the $SQLUsername and $SQLpassword variables.</li>
</ul>
<p>An example of how this should appear is below:</p>
<p><a href="/wp-content/uploads/2011/11/trusted.png"><img class="aligncenter size-full wp-image-1119" title="trusted" src="/wp-content/uploads/2011/11/trusted.png" alt="" width="493" height="98" /></a></p>
<h4><strong>Using an untrusted connection:</strong></h4>
<ul>
<li>Configure the $SqlTrustedConnection variable ( labelled below as 1:) as <strong>$false</strong></li>
<li>Configure the $SqlUserName variable as the SQL username labelled below as 2:) with the afforementioned access rights.</li>
<li>Configure the $SQLPassword variable as the SQL user&#8217;s password (labelled below as 3:)</li>
</ul>
<p><strong>Note:</strong> remember to wrap the<strong> username</strong> and <strong>password</strong> in quotes.</p>
<p>An example of how this should appear is below:</p>
<p><a href="/wp-content/uploads/2011/11/untrusted.png"><img class="aligncenter size-full wp-image-1118" title="untrusted" src="/wp-content/uploads/2011/11/untrusted.png" alt="" width="362" height="96" /></a></p>
<p>Once you&#8217;ve configured the Module to suit your environment, simply save it.<br />
<code><br />
</code></p>
<h2>Importing the Module:</h2>
<p><code><br />
</code><br />
Once you&#8217;ve modified to module to suit yourselves, its time to import the module and see if you&#8217;ve configured it correctly.</p>
<p>I suggest you change  your executionpolicy to unrestricted with the following command first to remove any overzealous security warnings:</p>
<pre>set-executionpolicy unrestricted</pre>
<p>Now, open a powershell window and run the following command: <em>(where c: is the location of the module)</em><br />
<code><br />
</code></p>
<pre>import-module C:Citrix.Edgesight.Cmdlets.psm1</pre>
<p><code><br />
</code><br />
<a href="/wp-content/uploads/2011/11/importmodule.png"><img class="aligncenter size-full wp-image-1120" title="importmodule" src="/wp-content/uploads/2011/11/importmodule.png" alt="" width="497" height="61" /></a></p>
<p><em></em>The module will either error out telling you that the details are incorrect as below:</p>
<p><a href="/wp-content/uploads/2011/11/failed.png"><img class="aligncenter size-full wp-image-1123" title="failed" src="/wp-content/uploads/2011/11/failed.png" alt="" width="600" height="75" /></a></p>
<p>Or confirm a database connection has been established:</p>
<p><a href="/wp-content/uploads/2011/11/success.png"><img class="aligncenter size-full wp-image-1122" title="success" src="/wp-content/uploads/2011/11/success.png" alt="" width="558" height="116" /></a></p>
<p>If the module imported correctly, try one of my powershell functions to see if you can retrieve information.</p>
<p>For example, try:</p>
<pre>get-esgroups</pre>
<p><code><br />
</code><br />
<a href="/wp-content/uploads/2011/11/get-esgroups.png"><img class="aligncenter size-full wp-image-1124" title="get-esgroups" src="/wp-content/uploads/2011/11/get-esgroups.png" alt="" width="600" height="60" /></a><br />
<code><br />
</code></p>
<h2>Adding and removing users from groups:</h2>
<p><code><br />
</code><br />
Once we have the module imported, now we can get to the important task of modifying the memberships of edgesight  groups. Lets do this manually once so we understand the process for active directory imports later.</p>
<p><strong>1: </strong>To retrieve an Edgesight user Group&#8217;s group ID, run the following command:</p>
<pre>get-esgroups</pre>
<p><code><br />
</code></p>
<p style="text-align:center;"><a href="/wp-content/uploads/2011/11/get-esgroups1.png"><img class="aligncenter size-full wp-image-1128" title="get-esgroups1" src="/wp-content/uploads/2011/11/get-esgroups1.png" alt="" width="600" height="86" /></a><em>For this article, we&#8217;ll assume we want to add users to &#8220;All Access Gateway Users&#8221;, so the groupid is 11.</em></p>
<p><strong>2: </strong>To clear the group, we can use the following command:</p>
<pre>Clear-ESgroupmembers -GroupID 11</pre>
<p><code><br />
</code></p>
<p style="text-align:center;"><a href="/wp-content/uploads/2011/11/clear-esgroupmembers.png"><img class="aligncenter size-full wp-image-1129" title="Clear-esgroupmembers" src="/wp-content/uploads/2011/11/clear-esgroupmembers.png" alt="" width="276" height="41" /></a><em>The command should return the amount of deleted users</em></p>
<p><code><br />
</code><br />
<strong>3:</strong> Because we need the Edgesight user&#8217;s PRID to add the member to the group, we can achieve that by running the following command: (where &#8220;user&#8221; is the users name is the login name)</p>
<pre>Get-ESUserPrid username</pre>
<p><code><br />
</code></p>
<p style="text-align:center;"><a href="/wp-content/uploads/2011/11/get-esuserprid.png"><img class="aligncenter size-full wp-image-1130" title="get-esuserprid" src="/wp-content/uploads/2011/11/get-esuserprid.png" alt="" width="255" height="33" /></a><em>I&#8217;ve omitted the username for privacy reasons.</em></p>
<p><code><br />
</code><br />
<strong>4:</strong> Once we have the PRID we can now add the user to the group:</p>
<pre>add-esgroupmember -GroupID 11 -Prid 26</pre>
<p><code><br />
</code></p>
<p style="text-align:center;"><a href="/wp-content/uploads/2011/11/add-esgroupmember.png"><img class="aligncenter size-full wp-image-1131" title="add-esgroupmember" src="/wp-content/uploads/2011/11/add-esgroupmember.png" alt="" width="406" height="14" /></a><em>If this returns no error, this has completed successfully</em></p>
<p><code><br />
</code><br />
<strong>5:</strong> To confirm this user is now in the correct group, try:</p>
<pre>get-esgroupmembers -GroupID 11</pre>
<p><code><br />
</code></p>
<p style="text-align:center;"><a href="/wp-content/uploads/2011/11/get-esgroupmembers1.png"><img class="aligncenter size-full wp-image-1133" title="get-esgroupmembers" src="/wp-content/uploads/2011/11/get-esgroupmembers1.png" alt="" width="600" height="99" /></a><em>You should see you user added as above.</em></p>
<p><code><br />
</code><br />
You can also check this in Edgesight by reviewing the group details:</p>
<p style="text-align:center;"><a href="/wp-content/uploads/2011/11/edgesight-confirm.png"><img class="aligncenter size-full wp-image-1134" title="edgesight confirm" src="/wp-content/uploads/2011/11/edgesight-confirm.png" alt="" width="402" height="125" /></a><em>I&#8217;ve omitted the username for privacy reasons.</em></p>
<p><code><br />
</code><br />
So now that we know a single user import works, lets try an active directory import.<br />
<code><br />
</code></p>
<h2>Importing from Active Directory:</h2>
<p>you will need the following items for this task:</p>
<ul>
<li>a Powershell module or snapin for listing members of groups. *</li>
<li>The active directory name group.</li>
<li>The GroupID you wish to add the users to.</li>
</ul>
<p>The basic concept behind this task, is to clear the current group then repopulate it with users from AD. Above I&#8217;ve walked you through one user, so now you understand the concept and can modify the script to import in bulk safe in the knowledge you know what is happening.</p>
<p>Now that you understand the process, its just a matter of using a powershell snapin or module to list active directory users and import them one by one.</p>
<p>Below you will find two examples using the quest and microsoft tools. These are fairly basic examples as each persons needs are different, the module is robust and flexible enough for you to script your own solution using these modules and I&#8217;ll happily help if you have a specific requirement not covered by these basic examples.</p>
<p><em>*In reference to the powershell module, they are numerous and available online, for the sake of completeness I&#8217;ve included the Quest tools &amp; the Microsoft ActiveDirectory module below for reference.</em><br />
<code><br />
</code></p>
<h5>Quest Active Directory Snapin:<code></code></h5>
<p>Below you will find an example on how to use the Quest active directory snapin for powershell to retrieve users from the group &#8220;<strong>Active directory user group</strong>&#8221; and populate the Edgesight user group <strong>20</strong> with these members.</p>
<p>For convenience, you can download this <a href="http://www.box.com/s/ji14lngj1fzj6cafl08r" target="_blank">here:</a></p>
<p>[sourcecode language=&#8221;PowerShell&#8221;]<br />
import-module &quot;C:citrix.edgesight.cmdlets.psm1&quot;<br />
add-pssnapin Quest.ActiveRoles.ADManagement<br />
$group=&quot;Active Directory User Group&quot;<br />
$esgroupid=20</p>
<p>#clear the group before import<br />
clear-esgroupmembers -groupid $esgroupid</p>
<p>#get users from group, then import them into edgesight<br />
foreach ($user in Get-QADGroupMember $group -type user -indirect -sizelimit 0){<br />
    $prid = get-ESUserPrid $user.logonname<br />
    if ($prid -NE $null){<br />
    Add-ESGroupMember -groupid $ESgroupid -prid $prid<br />
    }<br />
}#end For<br />
[/sourcecode]</p>
<p><code><br />
</code></p>
<h5>Microsoft ActiveDirectory Powershell module:<code></code></h5>
<p>Below you will find an example on how to use the Microsoft ActiveDirectory module for powershell to retrieve users from the group &#8220;<strong>Active directory user group</strong>&#8221; and populate the Edgesight user group <strong>20</strong> with these members.</p>
<p>For convenience, you can download this <a href="http://www.box.com/s/b01ecr7frnsjgsnmpm88" target="_blank">here:</a></p>
<p>[sourcecode language=&#8221;PowerShell&#8221;]<br />
import-module &quot;C:citrix.edgesight.cmdlets.psm1&quot;<br />
import-module activedirectory<br />
$group=&quot;Active Directory User Group&quot;<br />
$esgroupid=20</p>
<p>#clear the group before import<br />
clear-esgroupmembers -groupid $esgroupid</p>
<p>#get users from group, then import them into edgesight<br />
foreach ($user in Get-ADGroupMember $group -recursive){<br />
    $prid = get-ESUserPrid $user.samaccountname<br />
    if ($prid -NE $null){<br />
        Add-ESGroupMember -groupid $ESgroupid -prid $prid<br />
    }<br />
}#end For<br />
[/sourcecode]</p>
<h2>Keeping your groups up to date:</h2>
<p>Once you are happy that you have gotten the code to work for your environment, you can simply run these scripts as scheduled tasks and the groups will be cleared and repopulated when the scheduled task runs.</p>
<p>It&#8217;s that simple.</p>
<p><code><br />
</code></p>
<h2>Getting further help with these modules:</h2>
<p><code><br />
</code><br />
Once the module is imported, you can retrieve help on any of these commands by running &#8220;get-help (command)&#8221;, where command is the command you wish to retrieve help from.</p>
<p>I&#8217;m also quite happy to support and expand this module is necessary as I really enjoyed this project. Drop me a comment or email: andrew (at) andrewmorgan (dot) ie and I&#8217;ll see if I can help you with this.</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2011/11/importing-users-to-citrix-edgesight-user-groups-from-active-directory/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>List Members (and email addresses) of an Active Directory group.</title>
		<link>http://andrewmorgan.ie/2008/07/list-members-and-email-addresses-of-an-active-directory-group/</link>
		<comments>http://andrewmorgan.ie/2008/07/list-members-and-email-addresses-of-an-active-directory-group/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 09:09:16 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://andymorgan.wordpress.com/?p=51</guid>
		<description><![CDATA[Recently i was asked to list a: all members of an active directory group, and b: pull their primary email address, leaving me with an end report of username and primary email address. I used dsget to pull the user information from the group, below is the command i used: dsget group &#8220;cn=Groupname,ou=DLs,ou=Exchange Recipients,dc=ie,dc=domain,dc=company,dc=com&#8221; -members &#62;&#62; 1.txt the above command enumerates the &#8220;groupname&#8221; group in an ou called dls, in an ou called exchange recipients in the domain ie.domain.company.com. if [&#8230;]]]></description>
				<content:encoded><![CDATA[<p style="text-align:left;"><img class="alignright" src="/wp-content/uploads/2008/07/images.jpg" alt="" width="144" height="108" />Recently i was asked to list a: all members of an active directory group, and b: pull their primary email address, leaving me with an end report of username and primary email address.</p>
<p>I used <a href="http://technet2.microsoft.com/windowsserver/en/library/96a4a5ee-ee72-44d5-845f-71b2de33d4411033.mspx?mfr=true" target="_blank">dsget</a> to pull the user information from the group, below is the command i used:</p>
<p style="text-align:left;"><strong>dsget group &#8220;cn=Groupname,ou=DLs,ou=Exchange Recipients,dc=ie,dc=domain,dc=company,dc=com&#8221; -members &gt;&gt; 1.txt</strong></p>
<p>the above command enumerates the &#8220;groupname&#8221; group in an ou called dls, in an ou called exchange recipients in the domain ie.domain.company.com. if your ou or domain structure is different trim out (or add) what you need.  The -members at the end of the file will dump only the usernames in FQDN format.</p>
<p>Once the script is run check the current directory for a textfile called 1.txt.  This text file will contain the usernames you need in FQDN format like below:</p>
<p>&#8220;CN=Tom Thumb (IE),ou=Dublin,dc=ie,dc=domain,dc=company,dc=com&#8221;<br />
&#8220;CN=Mike Hunt (IE),ou=Dublin,dc=ie,dc=domain,dc=company,dc=com&#8221;</p>
<p>In order to get the email address&#8217;es i decided not to try and read from the file, instead i just ran the same command again and piped the results to another dsget query.</p>
<p><strong>dsget group &#8220;cn=Groupname,ou=DLs,ou=Exchange Recipients,dc=ie,dc=domain,dc=company,dc=com&#8221; -members | dsget user -email &gt;&gt; 2.txt</strong></p>
<p>The above will pull the results we saw in 1.txt, but instead it passes it straight into another query (dsget user -email) and sends those results to a text file. 2.txt should contain the users primary email address:</p>
<p>tom.thumb@company.com<br />
mike.hunt@company.ie</p>
<p>Now simply copy the contents on both text files into neighboring columns in excel and you have your report <img src="http://andrewmorgan.ie/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p><strong>Update: 13/08/2012</strong></p>
<p>An old friend of mine Rob reminded me that this post existed and wondered how to do it with powershell. Luckily This is much, much easier to do with Windows Powershell!</p>
<p>On a server with the active directory module for powershell installed (normally a domain controller), run the following commands: (replace the group name with your own one).</p>
<p>&nbsp;</p>
<p>[sourcecode language=&#8221;PowerShell&#8221;]</p>
<p>#######Change the below values#######<br />
$groupname = &quot;My Group Name&quot;<br />
$exportfile = c:tempreport.csv<br />
#####################################</p>
<p>if (!(get-module -ListAvailable | where {$_.name -eq &quot;ActiveDirectory1&quot;} -ea 0)){<br />
        write-warning &quot;The ActiveDirectory PowerShell module is Not Installed!&quot;<br />
        break}<br />
else{<br />
        write-host &quot;Importing Active directory module&quot;;import-module activedirectory -ea 0<br />
        Get-ADGroupmember $groupname | %{get-aduser $_.samaccountname -properties cn,samaccountname,emailaddress | select cn,samaccountname,emailaddress | export-csv -notypeinformation $exportfile}<br />
}<br />
[/sourcecode]</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2008/07/list-members-and-email-addresses-of-an-active-directory-group/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>how do i create custom .adm / group policy files?</title>
		<link>http://andrewmorgan.ie/2008/02/how-do-i-create-custom-adm-group-policy-files/</link>
		<comments>http://andrewmorgan.ie/2008/02/how-do-i-create-custom-adm-group-policy-files/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 11:49:50 +0000</pubDate>
		<dc:creator><![CDATA[andyjmorgan]]></dc:creator>
				<category><![CDATA[Group Policy]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[Citrix]]></category>
		<category><![CDATA[Group policy]]></category>
		<category><![CDATA[Internet explorer]]></category>

		<guid isPermaLink="false">http://joekickass.wordpress.com/?p=35</guid>
		<description><![CDATA[&#160; Update: With thanks to some great help and troubleshooting from Steven we have resolved the line 46 &#8220;Categor&#8221; error. In order for the adm to parse the ending y in this file an additional two blank lines or &#8220;carriage returns&#8221; are necessary at the base of the adm file. The download file has been updated, Thanks again Steven. A .adm file, is a group policy file that specifies policies outside of Microsoft&#8217;s default options. Basically they are policies you [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>&nbsp;</p>
<p><em><strong>Update:</strong> With thanks to some great help and troubleshooting from Steven we have resolved the line 46 &#8220;Categor&#8221; error. In order for the adm to parse the ending y in this file an additional two blank lines or &#8220;carriage returns&#8221; are necessary at the base of the adm file. The download file has been updated, Thanks again Steven.</em></p>
<p>A <em>.adm</em> file, is a group policy file that specifies policies outside of Microsoft&#8217;s default options. Basically they are policies you can put in place that Microsoft in their infinite wisdom forgot to put in before launch.</p>
<p>I had a situation recently where we have external users coming into our network, and using our CAG&#8217;s to access the the citrix environment. Once in there they needed access to an internal webpage that we published with internet explorer. The problem therein lied that these users could browse the local lan for resources with the address bar and many other wonderful utilities Microsoft put into internet explorer but failed to lock down efficiently.</p>
<p>All i really cared about (and for the interest of this post) was locking down the address bar in Internet Explorer 6.1. Nowhere could i find an option to do this, and i was getting nowhere fast. Searching internet explorer did bring back a few &#8220;helpful&#8221; articles on technet that i just couldnt understand, and i did find a piece of software that used to do it for free, until <strong>microsoft bought the company, stole its code </strong>for server 2008 and<strong> stopped people using </strong>or <strong>downloading the application. nice one microsoft&#8230;</strong></p>
<p>I have attached the policy settings and ADM files for reference on how to lock down internet explorer 6 completely, hopefully i will save somebody else 7 hours of their time.</p>
<p><span id="more-3067"></span></p>
<p>Long story short, no policy existed, no helpful application and because i needed this policy to only affect the users (and not the servers where internal staff use internet explorer too) i had to create the adm file myself.</p>
<p>I opened the word2003 adm file you get with ork 2003 and set about bodgeing the code to suit myself, The below entries disable the address and link bars by using registry entries. Remember you must still lock the toolbar in group policy to restrict these users from changing the tool bars.</p>
<blockquote><p>CLASS USER</p>
<p>CATEGORY &#8220;Internet Explorer Lockdown&#8221;<br />
KEYNAME &#8220;SoftwarePoliciesMicrosoftInternet ExplorerToolbarsRestrictions&#8221;<br />
POLICY &#8220;Disable internet explorer address bar&#8221;<br />
PART &#8220;Check to enforce setting on; uncheck to enforce setting off&#8221; CHECKBOX<br />
VALUENAME NoAddressBar<br />
VALUEON NUMERIC 1<br />
VALUEOFF NUMERIC 0<br />
END PART<br />
END POLICY<br />
POLICY &#8220;Disables internet explorer links bar&#8221;<br />
PART &#8220;Check to enforce setting on; uncheck to enforce setting off&#8221; CHECKBOX<br />
VALUENAME NoLinksBar<br />
VALUEON NUMERIC 1<br />
VALUEOFF NUMERIC 0<br />
END PART<br />
END POLICY<br />
END CATEGORY</p></blockquote>
<p>and to disable the other lockdowns i required (not covered in group policy&#8230;./sigh) disabling the search function, disabling the help bar and disabling mail/news are listed below.</p>
<blockquote><p>CATEGORY &#8220;Internet Explorer Lockdown&#8221;<br />
KEYNAME &#8220;SoftwarePoliciesMicrosoftInternet ExplorerRestrictions&#8221;<br />
POLICY &#8220;Disable internet explorer help bar&#8221;<br />
PART &#8220;Check to enforce setting on; uncheck to enforce setting off&#8221; CHECKBOX<br />
VALUENAME NoHelpMenu<br />
VALUEON NUMERIC 1<br />
VALUEOFF NUMERIC 0<br />
END PART<br />
END POLICY<br />
POLICY &#8220;Disable Mail&amp;News option&#8221;<br />
PART &#8220;Check to enforce setting on; uncheck to enforce setting off&#8221; CHECKBOX<br />
VALUENAME RestGoMenu<br />
VALUEON NUMERIC 1<br />
VALUEOFF NUMERIC 0<br />
END PART<br />
END POLICY<br />
END CATEGORY<br />
CATEGORY &#8220;Internet Explorer Lockdown&#8221;<br />
KEYNAME &#8220;SoftwareMicrosoftWindowsCurrentVersionPoliciesexplorer&#8221;<br />
POLICY &#8220;Disable Search Access&#8221;<br />
PART &#8220;Check to enforce setting on; uncheck to enforce setting off&#8221; CHECKBOX<br />
VALUENAME NoFind<br />
VALUEON NUMERIC 1<br />
VALUEOFF NUMERIC 0<br />
END PART<br />
END POLICY<br />
END CATEGORY</p></blockquote>
<p>Once i had the above all in one text document, saved it as a .adm file and imported it into group policy. Checked the options and hey presto, users were locked down. It took me over 8 hours to achieve the above (and the other default policy settings) realistically it shouldn&#8217;t have taken more than 2.</p>
<p>Files are <a href="http://www.4shared.com/file/49478948/c94b090c/Internet_explorer_Lockdown.html" target="_blank">here:</a></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewmorgan.ie/2008/02/how-do-i-create-custom-adm-group-policy-files/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
