<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>
	Comments on: Windows Batch Scripting: Mitgliedschaft von AD-Sicherheitsgruppen des Benutzers prüfenWindows Batch Scripting: Check if user is a member of an AD security group	</title>
	<atom:link href="https://www.dxsdata.com/2016/01/windows-batch-scripting-check-if-user-is-a-member-of-an-ad-security-group/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dxsdata.com/2016/01/windows-batch-scripting-check-if-user-is-a-member-of-an-ad-security-group/</link>
	<description>Software &#124; Network &#124; Administration</description>
	<lastBuildDate>Wed, 11 Mar 2020 19:18:12 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>
		By: Emile		</title>
		<link>https://www.dxsdata.com/2016/01/windows-batch-scripting-check-if-user-is-a-member-of-an-ad-security-group/#comment-115</link>

		<dc:creator><![CDATA[Emile]]></dc:creator>
		<pubDate>Wed, 11 Mar 2020 19:18:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.dxsdata.com/?p=1046#comment-115</guid>

					<description><![CDATA[:: if user is a member of group associated with S-1-5-21-167335082-2949395101-2103287839-2219 map drive O:
for /f &quot;tokens=* delims=&quot; %%i in (&#039;whoami /groups ^&#124; findstr &quot;S-1-5-21-167335082-2949395101-2103287839-2219&quot;&#039;) do (
IF errorlevel 0 if not errorlevel 1 call :mapo
)
:: if user is a member of group associated with S-1-5-21-167335082-2949395101-2103287839-1384 map drive L:
for /f &quot;tokens=* delims=&quot; %%i in (&#039;whoami /groups ^&#124; findstr &quot;S-1-5-21-167335082-2949395101-2103287839-1384&quot;&#039;) do (
IF errorlevel 0 if not errorlevel 1 call :mapl
)

exit /b 0

:: subroutines below
:mapo
net use O: /delete /y &#062;NUL
net use O: \\myserver\myshare0 &#062;NUL
exit /b 0

:mapl
net use L: /delete /y &#062;NUL
net use L: \\myserver\myshare1 &#062;NUL
exit /b 0]]></description>
			<content:encoded><![CDATA[<p>:: if user is a member of group associated with S-1-5-21-167335082-2949395101-2103287839-2219 map drive O:<br />
for /f &#8220;tokens=* delims=&#8221; %%i in (&#8216;whoami /groups ^| findstr &#8220;S-1-5-21-167335082-2949395101-2103287839-2219&#8243;&#8216;) do (<br />
IF errorlevel 0 if not errorlevel 1 call :mapo<br />
)<br />
:: if user is a member of group associated with S-1-5-21-167335082-2949395101-2103287839-1384 map drive L:<br />
for /f &#8220;tokens=* delims=&#8221; %%i in (&#8216;whoami /groups ^| findstr &#8220;S-1-5-21-167335082-2949395101-2103287839-1384&#8243;&#8216;) do (<br />
IF errorlevel 0 if not errorlevel 1 call :mapl<br />
)</p>
<p>exit /b 0</p>
<p>:: subroutines below<br />
:mapo<br />
net use O: /delete /y &gt;NUL<br />
net use O: \\myserver\myshare0 &gt;NUL<br />
exit /b 0</p>
<p>:mapl<br />
net use L: /delete /y &gt;NUL<br />
net use L: \\myserver\myshare1 &gt;NUL<br />
exit /b 0</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: sean		</title>
		<link>https://www.dxsdata.com/2016/01/windows-batch-scripting-check-if-user-is-a-member-of-an-ad-security-group/#comment-114</link>

		<dc:creator><![CDATA[sean]]></dc:creator>
		<pubDate>Wed, 26 Feb 2020 18:09:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.dxsdata.com/?p=1046#comment-114</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.dxsdata.com/2016/01/windows-batch-scripting-check-if-user-is-a-member-of-an-ad-security-group/#comment-113&quot;&gt;Yaroslav&lt;/a&gt;.

how can you do this for PC account not user?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.dxsdata.com/2016/01/windows-batch-scripting-check-if-user-is-a-member-of-an-ad-security-group/#comment-113">Yaroslav</a>.</p>
<p>how can you do this for PC account not user?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yaroslav		</title>
		<link>https://www.dxsdata.com/2016/01/windows-batch-scripting-check-if-user-is-a-member-of-an-ad-security-group/#comment-113</link>

		<dc:creator><![CDATA[Yaroslav]]></dc:creator>
		<pubDate>Sun, 16 Sep 2018 06:46:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.dxsdata.com/?p=1046#comment-113</guid>

					<description><![CDATA[Hi there. Your script always gives false positive result :(

Better to use net group check:

for /f %%f in (&#039;&quot;net group %ADgroup% /domain &#124; findstr /i %ADuser%&quot;&#039;) do set /a i=%i%+1]]></description>
			<content:encoded><![CDATA[<p>Hi there. Your script always gives false positive result 🙁</p>
<p>Better to use net group check:</p>
<p>for /f %%f in (&#8216;&#8221;net group %ADgroup% /domain | findstr /i %ADuser%&#8221;&#8216;) do set /a i=%i%+1</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
