<?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>phirebird &#187; active directory</title>
	<atom:link href="http://www.phirebird.net/tag/active-directory/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phirebird.net</link>
	<description>Yet Another IT &#039;How-To&#039; Site</description>
	<lastBuildDate>Wed, 29 Dec 2010 11:37:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Map drives based on user&#8217;s AD group membership using IFMEMBER</title>
		<link>http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/</link>
		<comments>http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 11:05:49 +0000</pubDate>
		<dc:creator>shands</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[group membership]]></category>
		<category><![CDATA[ifmember]]></category>
		<category><![CDATA[login script]]></category>

		<guid isPermaLink="false">http://www.phirebird.net/?p=99</guid>
		<description><![CDATA[Login scripts are very handy &#8211; but when it comes to mapping drives (or processing other commands) based on the users active directory group membership &#8211; it can be a bit of a pain. Thats where Ifmember.exe (part of the Windows Server 2003 Resource Kit) comes in. You can get this to work for you [...]]]></description>
			<content:encoded><![CDATA[<p>Login scripts are very handy &#8211; but when it comes to mapping drives (or processing other commands) based on the users active directory group membership &#8211; it can be a bit of a pain.</p>
<p>Thats where Ifmember.exe (part of the Windows Server 2003 Resource Kit) comes in.</p>
<p>You can get this to work for you in one of two ways. The first is to have it call it from within your login script and then evaluate the errorlevel (Errorlevel 1 if they are a member or 0 if not) &#8211; which is multiline and not very tidy. The other option is to use conditional execution (executes additional commands depending on which errorlevel the command returns).</p>
<p>Perhaps the best way to explain this is through a few examples:</p>
<blockquote><p><span>ifmember Finance || net use f: \\server\finance</span></p></blockquote>
<p><span>Assuming that the current user *is* a member of the &#8216;Finance&#8217; group &#8211; it will map drive F. Similarly, you can use &amp;&amp; instead to process commands if the user is *NOT* a member of Finance:</span></p>
<blockquote><p><span><span>ifmember Finance &amp;&amp; net use f: \\server\someothershare</span></span></p></blockquote>
<p><span><span>Of course, these examples both assume that ifmember.exe is in the local machines search path (or it&#8217;s being called from the same directory as the script). Another option is that you could call it through a UNC path:</span></span></p>
<blockquote><p><span><span>\\server\tools\ifmember.exe Finance || net use f: \\server\finance</span></span></p></blockquote>
<p><span><span> Which works quite well!</span></span></p>
<p><span><span>You can obtain ifmember.exe either as part of the Windows 2003 Server Resource Kit Tools from Microsoft here (which is well worth doing!):</span></span></p>
<blockquote><p><span><span><a href="http://www.microsoft.com/Downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&amp;displaylang=en">http://www.microsoft.com/Downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&amp;displaylang=en</a></span></span></p></blockquote>
<p><span><span>Or you can get just the file itself from:</span></span></p>
<blockquote><p><span><span><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=07C2F6D7-815E-4FA0-9043-4E4635CCD417&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyID=07C2F6D7-815E-4FA0-9043-4E4635CCD417&amp;displaylang=en</a></span></span></p></blockquote>
<p>&nbsp;</p>
<p>Did you find this hint useful? Are you looking to learn more? Well, here&#8217;s a few books that I&#8217;ve found useful &#8211; have a goosie!</p>
<table width="100%">
<tr>
<td valign="top" align="center"><a href="http://www.amazon.co.uk/gp/product/0470287209?ie=UTF8&#038;tag=beabi-21"><img src="http://ecx.images-amazon.com/images/I/51fHA8c9zXL._SL100.jpg" border="0"><br />
Active Directory for Dummies</a></td>
<td>&nbsp;</td>
<td valign="top" align="center"><a href="http://www.amazon.co.uk/gp/product/1592000851?ie=UTF8&#038;tag=beabi-21"><img src="http://ecx.images-amazon.com/images/I/517yuSCbi5L._SL100.jpg" border="0"><br />
Microsoft Windows Shell Script Programming</a></td>
<td>&nbsp;</td>
<td valign="top" align="center"><a href="http://www.amazon.co.uk/gp/product/1578701392?ie=UTF8&#038;tag=beabi-21"><img src="http://ecx.images-amazon.com/images/I/41y8XN69oTL._SL100.jpg" border="0"><br />
Microsoft Windows Script Host</a></td>
<td>&nbsp;</td>
<td valign="top" align="center"><a href="http://www.amazon.co.uk/gp/product/0782141307?ie=UTF8&#038;tag=beabi-21"><img src="http://ecx.images-amazon.com/images/I/518YC3V0AFL._SL100.jpg" border="0"><br />
Mastering Windows Server 2003</a></td>
</tr>
</table>
<p>&nbsp;<br />
<br />&nbsp;</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-knowledge">
<ul class="socials">
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/&amp;n=Map+drives+based+on+user%27s+AD+group+membership+using+IFMEMBER&amp;pli=1" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/&amp;title=Map+drives+based+on+user%27s+AD+group+membership+using+IFMEMBER" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/&amp;title=Map+drives+based+on+user%27s+AD+group+membership+using+IFMEMBER" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/&amp;t=Map+drives+based+on+user%27s+AD+group+membership+using+IFMEMBER" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/&amp;title=Map+drives+based+on+user%27s+AD+group+membership+using+IFMEMBER" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/&amp;title=Map+drives+based+on+user%27s+AD+group+membership+using+IFMEMBER" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Map+drives+based+on+user%27s+AD+group+membership+using+IFMEMBER+-+http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.phirebird.net/2009/08/map-drives-based-on-users-ad-group-membership-using-ifmember/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

