<?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>Who... What... Where... &#187; Active Directory</title>
	<atom:link href="http://www.yeltuor.com/articles/tag/active-directory/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yeltuor.com</link>
	<description>General things I find interesting</description>
	<lastBuildDate>Sun, 02 Aug 2009 09:58:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>VB WMI Examples</title>
		<link>http://www.yeltuor.com/reference/vb-wmi-examples/</link>
		<comments>http://www.yeltuor.com/reference/vb-wmi-examples/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 14:50:06 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[VB]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://www.yeltuor.com/?page_id=133</guid>
		<description><![CDATA[All below examples are based on establishing a connection to a remote computer and performing a WMI query.
Computer Disk Information
Retrieves information about all physical disks (distinguished by the numerical value 3), and displays ins volume identifier (drive letter) and free vs used space.
Const HARD_DISK = 3
Set objWMIService = GetObject(&#8220;winmgmts:&#8221; &#38; &#8220;{impersonationLevel=impersonate}!\\&#8221; &#38; &#8220;COMPUTER&#8221; &#38; &#8220;\root\cimv2&#8243;)
Set [...]]]></description>
			<content:encoded><![CDATA[<p>All below examples are based on establishing a connection to a remote computer and performing a WMI query.</p>
<h2><strong>Computer Disk Information</strong></h2>
<p>Retrieves information about all physical disks (distinguished by the numerical value 3), and displays ins volume identifier (drive letter) and free vs used space.</p>
<blockquote><p>Const HARD_DISK = 3</p>
<p>Set objWMIService = GetObject(&#8220;winmgmts:&#8221; &amp; &#8220;{impersonationLevel=impersonate}!\\&#8221; &amp; &#8220;COMPUTER&#8221; &amp; &#8220;\root\cimv2&#8243;)</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Set colDisks = objWMIService.ExecQuery (&#8220;Select * from Win32_LogicalDisk Where DriveType = &#8221; &amp; HARD_DISK &amp; &#8220;&#8221;)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>For Each objDisk in colDisks</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>&#8216;objDisk.FreeSpace</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>&#8216;Wscript.Echo objDisk.DeviceID</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>Wscript.Echo objDisk.DeviceID + &#8221; Disk Size (GB): &#8221; + CStr(Round((((objDisk.Size / 1024)/1024)/1024),1))</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>Wscript.Echo objDisk.DeviceID + &#8221; Free Disk Space (GB): &#8221; + CStr(Round((((objDisk.FreeSpace / 1024)/1024)/1024),2))</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>Next</div>
<p>Set colDisks = objWMIService.ExecQuery (&#8220;Select * from Win32_LogicalDisk Where DriveType = &#8221; &amp; HARD_DISK &amp; &#8220;&#8221;)</p>
<p><span style="white-space:pre"> </span>For Each objDisk in colDisks</p>
<p style="padding-left: 30px; "><span style="white-space:pre"> </span>Wscript.Echo objDisk.DeviceID + &#8221; Disk Size (GB): &#8221; + CStr(Round((((objDisk.Size / 1024)/1024)/1024),1))</p>
<p style="padding-left: 30px; "><span style="white-space:pre"> </span>Wscript.Echo objDisk.DeviceID + &#8221; Free Disk Space (GB): &#8221; + CStr(Round((((objDisk.FreeSpace / 1024)/1024)/1024),2))</p>
<p><span style="white-space:pre"> </span>Next</p></blockquote>
<h2>Network Card Information</h2>
<p>Retrieves information about the Network Cards configured on the computer, looping through all valid adapters present.</p>
<blockquote><p>Set objWMIService = GetObject(&#8220;winmgmts:&#8221; &amp; &#8220;{impersonationLevel=impersonate}!\\&#8221; &amp; &#8220;COMPUTER&#8221; &amp; &#8220;\root\cimv2&#8243;)</p>
<p>Set colAdapters = objWMIService.ExecQuery (&#8220;Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE&#8221;)</p>
<p><span style="white-space: pre;"> </span>j = 1</p>
<p><span style="white-space: pre;"> </span>For Each objAdapter in colAdapters</p>
<p style="padding-left: 30px; ">Wscript.Echo &#8220;===Adapter &#8221; &amp; CStr(j)</p>
<p style="padding-left: 30px; ">If Not IsNull(objAdapter.IPAddress) Then</p>
<p style="padding-left: 60px;">For i=LBound(objAdapter.IPAddress) to UBound(objAdapter.IPAddress)</p>
<p style="padding-left: 90px;">Wscript.Echo &#8220;IP Address: &#8221; + objAdapter.IPAddress(i)</p>
<p style="padding-left: 90px;">WScript.Echo &#8220;Subnet: &#8221; &amp; objAdapter.IPSubnet(i)</p>
<p style="padding-left: 60px;">Next</p>
<p style="padding-left: 60px;">WScript.Echo &#8220;Gateway: &#8221; &amp; objAdapter.DefaultIPGateway(0)</p>
<p><span style="white-space: pre;"> </span></p>
<p style="padding-left: 60px;">For i = 0 To UBound(objAdapter.DNSServerSearchOrder)</p>
<p style="padding-left: 90px;">WScript.Echo &#8220;DNS Server: &#8221; &amp; objAdapter.DNSServerSearchOrder(i)</p>
<p style="padding-left: 60px;">Next</p>
<p style="padding-left: 60px;">
<p style="padding-left: 60px;">For i = 0 To UBound(objAdapter.DNSDomainSuffixSearchOrder)</p>
<p style="padding-left: 90px;">WScript.Echo &#8220;DNS suffix list: &#8221; &amp; objAdapter.DNSDomainSuffixSearchOrder(i)</p>
<p style="padding-left: 60px;">Next<span style="white-space: pre;"> </span></p>
<p style="padding-left: 30px;">End If</p>
<p><span style="white-space: pre;"> </span>j = j+1</p>
<p>Next</p></blockquote>
<h2>Operating System / up-time Information</h2>
<p>Retrieves Information about the host operating system and current service pack, also information on the up-time of the host; be aware that if the regional settings differ the results may appear inaccurate.</p>
<blockquote><p>Set colOperatingSystems = objWMIService.ExecQuery (&#8220;Select * from Win32_OperatingSystem&#8221;)</p>
<p>For Each objOS in colOperatingSystems</p>
<p style="padding-left: 30px;">dtmBootup = objOS.LastBootUpTime</p>
<p style="padding-left: 30px;">dtmLastBootupTime = WMIDateStringToDate(dtmBootup)</p>
<p style="padding-left: 30px;">dtmSystemUptime = DateDiff(&#8220;n&#8221;, dtmLastBootUpTime, Now)</p>
<p style="padding-left: 30px;">Wscript.Echo &#8220;Uptime: &#8221; &amp; CStr(Round((dtmSystemUptime /60) /24)) &amp; &#8221; Day(s)&#8221;<span style="white-space:pre"> </span></p>
<p>Next</p>
<p>For Each objOperatingSystem in colOperatingSystems</p>
<p style="padding-left: 30px;">Wscript.Echo &#8220;OS: &#8221; &amp; objOperatingSystem.Caption &amp; &#8221; &#8221; &amp; objOperatingSystem.Version</p>
<p style="padding-left: 30px;">Wscript.Echo &#8220;Service Pack: &#8221; &amp; objOperatingSystem.ServicePackMajorVersion &amp; &#8220;.&#8221; &amp; objOperatingSystem.ServicePackMinorVersion</p>
<p>Next</p>
<p>Function WMIDateStringToDate(dtmBootup)</p>
<p style="padding-left: 30px;">WMIDateStringToDate = CDate(Mid(dtmBootup, 5, 2) &amp; &#8220;/&#8221; &amp; _</p>
<p style="padding-left: 60px;">Mid(dtmBootup, 7, 2) &amp; &#8220;/&#8221; &amp; Left(dtmBootup, 4) _</p>
<p style="padding-left: 90px;">&amp; &#8221; &#8221; &amp; Mid (dtmBootup, 9, 2) &amp; &#8220;:&#8221; &amp; _</p>
<p style="padding-left: 120px;">Mid(dtmBootup, 11, 2) &amp; &#8220;:&#8221; &amp; Mid(dtmBootup,13, 2))</p>
<p>End Function<span style="white-space: pre;"> </span></p></blockquote>
<h2>Symantec Antivirus Definition Version</h2>
<p>This query has been tested on versions 7.x and 9.x. The principle is to connect to the remote file system and read the contents of the file named &#8220;definfo.dat&#8221; to define the date / version of the definitions loaded on the target computer.</p>
<blockquote><p>Set objFSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)</p>
<p>Set objFile = objFSO.GetFile(&#8220;\\&#8221; &amp; &#8220;COMPUTER&#8221; &amp; &#8220;\c$\Program Files\Common Files\Symantec Shared\VirusDefs\definfo.dat&#8221;)</p>
<p>If objFSO.FileExists(objFile) Then</p>
<p style="padding-left: 30px;">Set objDatFile = objFSO.OpenTextFile(objFile, 1)</p>
<p style="padding-left: 30px;">Do Until objDatFile.AtEndOfStream</p>
<p style="padding-left: 60px;">strLine = objDatFile.Readline</p>
<p style="padding-left: 60px;">intCurDefs = InStr(strLine , &#8220;CurDefs&#8221;)</p>
<p><span style="white-space: pre;"> </span></p>
<p style="padding-left: 60px;">If intCurDefs &gt; 0 Then</p>
<p style="padding-left: 90px;">strCurDefs = strLine</p>
<p style="padding-left: 90px;">strDateDefs = Mid(strCurDefs, 9, 8 )</p>
<p style="padding-left: 90px;">dtYear = Left(strDateDefs, 4)</p>
<p style="padding-left: 90px;">dtMonth = Mid(strDateDefs, 5, 2)</p>
<p style="padding-left: 90px;">dtDay = Right(strDateDefs, 2)</p>
<p style="padding-left: 90px;">DateVirDefs = dtMonth &amp; &#8220;/&#8221; &amp; dtDay &amp; &#8220;/&#8221; &amp; dtYear</p>
<p style="padding-left: 90px;">dtDefDate = CDate(DatevirDefs)</p>
<p style="padding-left: 90px;">strRevNumber = Right(strCurDefs, 3)</p>
<p style="padding-left: 90px;">
<p style="padding-left: 90px;">Wscript.Echo &#8220;Definition: &#8221; &amp; dtDefDate &amp; &#8221; &#8221; &amp; strRevNumber</p>
<p style="padding-left: 60px;">End If</p>
<p style="padding-left: 30px;">Loop</p>
<p style="padding-left: 30px;">objDatFile.Close</p>
<p>Else</p>
<p style="padding-left: 30px;">Wscript.Echo &#8220;The file definfo.dat does not exist&#8221;</p>
<p>End If</p></blockquote>
<p>All of the above queries have been rolled up with into once script which also combines an <a title="VB Query Active Directory Objects" href="http://www.yeltuor.com/articles/script/vb-query-active-directory-objects/">AD query</a> element; this script can be downloaded <a title="Server_Info VBS File" href="http://www.yeltuor.com/files/Server_Info.vbs">here</a></p>

	Tags: <a href="http://www.yeltuor.com/articles/tag/active-directory/" title="Active Directory" rel="tag">Active Directory</a>, <a href="http://www.yeltuor.com/articles/tag/vb/" title="VB" rel="tag">VB</a>, <a href="http://www.yeltuor.com/articles/tag/wmi/" title="WMI" rel="tag">WMI</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.yeltuor.com/reference/vb-wmi-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB WMI Query Computer Attributes</title>
		<link>http://www.yeltuor.com/articles/script/vb-wmi-query-computer-attri/</link>
		<comments>http://www.yeltuor.com/articles/script/vb-wmi-query-computer-attri/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 09:58:13 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Scripting Snippets]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[VB]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://www.yeltuor.com/?p=117</guid>
		<description><![CDATA[By using a VB scripts we can perform a WMI (Windows Management Instrumentation) connection to a host to execute a query against.
Below is an example of a WMI query connecting to the host named &#8220;computer&#8221;, once connected will loop around each drive letter which is a hard drive displaying the drive letter and total disk [...]]]></description>
			<content:encoded><![CDATA[<p>By using a VB scripts we can perform a WMI (Windows Management Instrumentation) connection to a host to execute a query against.</p>
<p>Below is an example of a WMI query connecting to the host named &#8220;computer&#8221;, once connected will loop around each drive letter which is a hard drive displaying the drive letter and total disk space in GB</p>
<blockquote><p>On Error Resume Next<br />
Const HARD_DISK = 3</p>
<p>Set objWMIService = GetObject(&#8220;winmgmts:&#8221; &amp; &#8220;{impersonationLevel=impersonate}!\\&#8221; &amp; &#8220;computer&#8221; &amp; &#8220;\root\cimv2&#8243;)</p>
<p>if Err.Number = 0 then<br />
&#8216; Add WMI Query Script in here!</p>
<p>Set colDisks = objWMIService.ExecQuery (&#8220;Select * from Win32_LogicalDisk Where DriveType = &#8221; &amp; HARD_DISK &amp; &#8220;&#8221;)<br />
For Each objDisk in colDisks</p>
<p>Wscript.Echo objDisk.DeviceID + &#8221; Disk Size (GB): &#8221; + CStr(Round((((objDisk.Size / 1024)/1024)/1024),1))</p>
<p>Next</p>
<p>else<br />
Wscript.echo &#8220;Could not connect to &#8221; &amp; &#8220;computer&#8221; &amp; &#8221; error &#8221; &amp; Err.Number<br />
End If</p>
<p>Err.Clear</p></blockquote>
<p>The above WMI query can be combined with an Active Directory query to make the script more versatile (further information is <a href="http://www.yeltuor.com/articles/script/vb-query-active-directory-objects">here</a>), an example of this script is below:</p>
<blockquote><p>On Error Resume Next<br />
Const ADS_SCOPE_SUBTREE = 2<br />
Const HARD_DISK = 3</p>
<p>Set objConnection = CreateObject(&#8220;ADODB.Connection&#8221;)<br />
Set objCommand =   CreateObject(&#8220;ADODB.Command&#8221;)<br />
objConnection.Provider = &#8220;ADsDSOObject&#8221;<br />
objConnection.Open &#8220;Active Directory Provider&#8221;</p>
<p>Set objCOmmand.ActiveConnection = objConnection<br />
objCommand.CommandText = “Select Name from ‘LDAP://OU=MyServers,DC=Domain,DC=co,DC=uk’ ” &amp; “Where objectClass=’computer’”<br />
objCommand.Properties(”Page Size”) = 1000<br />
objCommand.Properties(”Searchscope”) = ADS_SCOPE_SUBTREE<br />
Set objRecordSet = objCommand.Execute<br />
objRecordSet.MoveFirst</p>
<p>Do Until objRecordSet.EOF<br />
Wscript.Echo &#8220;Computer Name: &#8221; &amp; objRecordSet.Fields(&#8220;Name&#8221;).Value</p>
<p>Set objWMIService = GetObject(&#8220;winmgmts:&#8221; &amp; &#8220;{impersonationLevel=impersonate}!\\&#8221; &amp; objRecordSet.Fields(&#8220;Name&#8221;).Value &amp; &#8220;\root\cimv2&#8243;)</p>
<p>if Err.Number = 0 then</p>
<p>&#8216; Add WMI Query Script in here!</p>
<p>else<br />
Wscript.echo &#8220;Could not connect to &#8221; &amp; objRecordSet.Fields(&#8220;Name&#8221;).Value &amp; &#8221; error &#8221; &amp; Err.Number<br />
End If</p>
<p>Err.Clear<br />
objRecordSet.MoveNext<br />
Loop</p></blockquote>
<p>A number of WMI queries used can be found in the reference page <a href="http://www.yeltuor.com/">WMI_Queries</a></p>

	Tags: <a href="http://www.yeltuor.com/articles/tag/active-directory/" title="Active Directory" rel="tag">Active Directory</a>, <a href="http://www.yeltuor.com/articles/tag/vb/" title="VB" rel="tag">VB</a>, <a href="http://www.yeltuor.com/articles/tag/wmi/" title="WMI" rel="tag">WMI</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.yeltuor.com/articles/script/vb-wmi-query-computer-attri/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active Directory LDAP</title>
		<link>http://www.yeltuor.com/reference/active-directory-ldap-attributes/</link>
		<comments>http://www.yeltuor.com/reference/active-directory-ldap-attributes/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 20:07:21 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[reference]]></category>

		<guid isPermaLink="false">http://www.yeltuor.com/?page_id=98</guid>
		<description><![CDATA[Below are a series of tables that show a mapping of Active Directory attributes to there LDAP counter parts



AD User Attribute
LDAP Attribute


Name
cn


General



First name
givenName


Initials
initials


Last name
sn


Display name
displayName


Description
description


Office
physicalDeliveryOfficeName


Telephone number
telephoneNumber


Other Telephone numbers
otherTelephone


E-mail
mail


Web page
wWWHomePage


Other Web pages
url


Address



Street
streetAddress


P.O. Box
postOfficeBox


City
l


State/province
st


Zip/Postal Code
postalCode


Country/region
c, co, countryCode


Account



User logon name
userPrincipalName


pre-Windows 2000 logon name
sAMAccountName


Account disabled
userAccountControl


User must change password at next logon
pwdLastSet


Account expires end of (date)
accountExpires


Profile



User Profile path
profilePath


Logon script
scriptPath


Home folder, [...]]]></description>
			<content:encoded><![CDATA[<p>Below are a series of tables that show a mapping of Active Directory attributes to there LDAP counter parts</p>
<table border="0" cellspacing="0" cellpadding="0" width="500">
<tbody>
<tr>
<td width="200"><strong>AD User Attribute</strong></td>
<td><strong>LDAP Attribute</strong></td>
</tr>
<tr>
<td>Name</td>
<td>cn</td>
</tr>
<tr>
<td><strong>General</strong></td>
<td></td>
</tr>
<tr>
<td>First name</td>
<td>givenName</td>
</tr>
<tr>
<td>Initials</td>
<td>initials</td>
</tr>
<tr>
<td>Last name</td>
<td>sn</td>
</tr>
<tr>
<td>Display name</td>
<td>displayName</td>
</tr>
<tr>
<td>Description</td>
<td>description</td>
</tr>
<tr>
<td>Office</td>
<td>physicalDeliveryOfficeName</td>
</tr>
<tr>
<td>Telephone number</td>
<td>telephoneNumber</td>
</tr>
<tr>
<td>Other Telephone numbers</td>
<td>otherTelephone</td>
</tr>
<tr>
<td>E-mail</td>
<td>mail</td>
</tr>
<tr>
<td>Web page</td>
<td>wWWHomePage</td>
</tr>
<tr>
<td>Other Web pages</td>
<td>url</td>
</tr>
<tr>
<td><strong>Address</strong></td>
<td></td>
</tr>
<tr>
<td>Street</td>
<td>streetAddress</td>
</tr>
<tr>
<td>P.O. Box</td>
<td>postOfficeBox</td>
</tr>
<tr>
<td>City</td>
<td>l</td>
</tr>
<tr>
<td>State/province</td>
<td>st</td>
</tr>
<tr>
<td>Zip/Postal Code</td>
<td>postalCode</td>
</tr>
<tr>
<td>Country/region</td>
<td>c, co, countryCode</td>
</tr>
<tr>
<td><strong>Account</strong></td>
<td></td>
</tr>
<tr>
<td>User logon name</td>
<td>userPrincipalName</td>
</tr>
<tr>
<td>pre-Windows 2000 logon name</td>
<td>sAMAccountName</td>
</tr>
<tr>
<td>Account disabled</td>
<td>userAccountControl</td>
</tr>
<tr>
<td>User must change password at next logon</td>
<td>pwdLastSet</td>
</tr>
<tr>
<td>Account expires end of (date)</td>
<td>accountExpires</td>
</tr>
<tr>
<td><strong>Profile</strong></td>
<td></td>
</tr>
<tr>
<td>User Profile path</td>
<td>profilePath</td>
</tr>
<tr>
<td>Logon script</td>
<td>scriptPath</td>
</tr>
<tr>
<td>Home folder, local path</td>
<td>homeDirectory</td>
</tr>
<tr>
<td>Home folder, Connect, Drive</td>
<td>homeDrive</td>
</tr>
<tr>
<td>Home folder, Connect, To:</td>
<td>homeDirectory</td>
</tr>
<tr>
<td><strong>Telephones</strong></td>
<td></td>
</tr>
<tr>
<td>Home</td>
<td>homePhone</td>
</tr>
<tr>
<td>Other Home phone numbers</td>
<td>otherHomePhone</td>
</tr>
<tr>
<td>Pager</td>
<td>pager</td>
</tr>
<tr>
<td>Mobile</td>
<td>mobile</td>
</tr>
<tr>
<td>Fax</td>
<td>facsimileTelephoneNumber</td>
</tr>
<tr>
<td>Notes</td>
<td>info</td>
</tr>
<tr>
<td><strong>Organization</strong></td>
<td></td>
</tr>
<tr>
<td>Title</td>
<td>title</td>
</tr>
<tr>
<td>Department</td>
<td>department</td>
</tr>
<tr>
<td>Company</td>
<td>company</td>
</tr>
<tr>
<td>Manager</td>
<td>manager</td>
</tr>
</tbody>
</table>
<p>Object class “computer”</p>
<table border="0" cellspacing="0" cellpadding="0" width="500">
<tbody>
<tr>
<td><strong>AD Computer Attribute</strong></td>
<td width="200"><strong>LDAP Attribute</strong></td>
</tr>
<tr>
<td>Name</td>
<td>cn</td>
</tr>
<tr>
<td>Location<strong><br />
</strong></td>
<td>location</td>
</tr>
<tr>
<td>Description</td>
<td>description</td>
</tr>
<tr>
<td>Operating System Version</td>
<td>operatingSystem</td>
</tr>
<tr>
<td>OS Service Pack</td>
<td>operatingSystemServicePack</td>
</tr>
<tr>
<td>Group Membership</td>
<td>memberOf</td>
</tr>
</tbody>
</table>
<p>Object class “group”</p>
<table border="0" cellspacing="0" cellpadding="0" width="500">
<tbody>
<tr>
<td width="200"><strong>AD Group Attribute</strong></td>
<td><strong>LDAP Attribute</strong></td>
</tr>
<tr>
<td>Name</td>
<td>cn</td>
</tr>
<tr>
<td>Member of Group<strong><br />
</strong></td>
<td>member</td>
</tr>
<tr>
<td>Description</td>
<td>description</td>
</tr>
<tr>
<td>Group Type (global/universal/security)</td>
<td>instanceType</td>
</tr>
</tbody>
</table>

	Tags: <a href="http://www.yeltuor.com/articles/tag/active-directory/" title="Active Directory" rel="tag">Active Directory</a>, <a href="http://www.yeltuor.com/articles/tag/ldap/" title="LDAP" rel="tag">LDAP</a>, <a href="http://www.yeltuor.com/articles/tag/reference/" title="reference" rel="tag">reference</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.yeltuor.com/reference/active-directory-ldap-attributes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB Query Active Directory Objects</title>
		<link>http://www.yeltuor.com/articles/script/vb-query-active-directory-objects/</link>
		<comments>http://www.yeltuor.com/articles/script/vb-query-active-directory-objects/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 19:56:58 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Scripting Snippets]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[VB]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.yeltuor.com/?p=89</guid>
		<description><![CDATA[In an Active Directory environment there is often a requirement to query objects within the AD  database, either returning selected attribute values or using this information to for further queries.
The same principles apply across any object type, the script below connects via LDAP, performs a query and returns selected values from Active Directory.
The below script [...]]]></description>
			<content:encoded><![CDATA[<p>In an Active Directory environment there is often a requirement to query objects within the AD  database, either returning selected attribute values or using this information to for further queries.</p>
<p>The same principles apply across any object type, the script below connects via LDAP, performs a query and returns selected values from Active Directory.</p>
<p>The below script will query all objects in the OU <em>MyServers</em> and subtree, in the domain <em>Domain.co.uk</em>, of type <em>computer</em>, returning the attributes <em>Name </em>and <em>Location</em>.</p>
<blockquote><p>Const ADS_SCOPE_SUBTREE = 2</p>
<p>Set objConnection = CreateObject(”ADODB.Connection”)<br />
Set objCommand = CreateObject(”ADODB.Command”)<br />
objConnection.Provider = “ADsDSOObject”<br />
objConnection.Open “Active Directory Provider”</p>
<p>Set objCOmmand.ActiveConnection = objConnection<br />
objCommand.CommandText = “Select Name, Location from ‘LDAP://OU=MyServers,DC=Domain,DC=co,DC=uk’ ” &amp; “Where objectClass=’computer’”<br />
objCommand.Properties(”Page Size”) = 1000<br />
objCommand.Properties(”Searchscope”) = ADS_SCOPE_SUBTREE<br />
Set objRecordSet = objCommand.Execute<br />
objRecordSet.MoveFirst<br />
Do Until objRecordSet.EOF</p>
<p>‘ Insert Operators here<br />
objRecordSet.MoveNext</p>
<p>Loop</p></blockquote>
<p>Once the query has been run the results can then be used for any requirement, a simple example below is to display  the name of the computer followed by the Location attribute stored in AD.</p>
<blockquote><p>……<br />
Do Until objRecordSet.EOF</p>
<p>‘ Insert Operators here<br />
Wscript.Echo “Computer Name: ” &amp; objRecordSet.Fields(”Name”).Value<br />
Wscript.Echo “Location: ” &amp; objRecordSet.Fields(”Location”).Value</p>
<p>objRecordSet.MoveNext<br />
Loop</p></blockquote>
<p>Any attribute of the object can be displayed as long as it was requested in the initial query; <em>Select Name, Location from….</em> , attribute names are LDAP attributes rather than field names seen in the Active Directory Users and Computers mmc. A list of attributes can be found here; <a href="http://www.yeltuor.com/reference/active-directory-ldap-attributes/">Active Directory LDAP Attributes</a></p>
<p>One way to enhance this script further is for each computer selected perform a WMI query against it; <a href="http://www.yeltuor.com/">VB WMI Query</a></p>

	Tags: <a href="http://www.yeltuor.com/articles/tag/active-directory/" title="Active Directory" rel="tag">Active Directory</a>, <a href="http://www.yeltuor.com/articles/tag/ldap/" title="LDAP" rel="tag">LDAP</a>, <a href="http://www.yeltuor.com/articles/tag/vb/" title="VB" rel="tag">VB</a>, <a href="http://www.yeltuor.com/articles/tag/windows/" title="Windows" rel="tag">Windows</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.yeltuor.com/articles/script/vb-query-active-directory-objects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AD Command Line Queries</title>
		<link>http://www.yeltuor.com/articles/script/ad-command-line-queries/</link>
		<comments>http://www.yeltuor.com/articles/script/ad-command-line-queries/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 20:48:31 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Scripting Snippets]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Query]]></category>

		<guid isPermaLink="false">http://www.yeltuor.com/?p=84</guid>
		<description><![CDATA[There are a number of ways to query the Active Directory database to export objects and there attributes. One of the most common groups of tools are provided by Microsoft; dsget and dsquery.
Query Group Members
To display the member of a specific group use the dsget group command
dsget group &#8220;CN=My Group,OU=Domain Groups,DC=Domain,DC=co,DC=uk&#8221; -members
The above command will [...]]]></description>
			<content:encoded><![CDATA[<p>There are a number of ways to query the Active Directory database to export objects and there attributes. One of the most common groups of tools are provided by Microsoft; <em>dsget</em> and <em>dsquery.</em></p>
<h3>Query Group Members</h3>
<p>To display the member of a specific group use the <em>dsget group</em> command</p>
<blockquote><p>dsget group &#8220;CN=My Group,OU=Domain Groups,DC=Domain,DC=co,DC=uk&#8221; -members</p></blockquote>
<p>The above command will list the UPN of the users in <em>My Group</em>, if more information is required from each of the users within <em>My Group</em> the output can be piped into another dsget command</p>
<p>To display the member of a specific group use the <em>dsget group</em> command</p>
<blockquote><p>dsget group &#8220;CN=My Group,OU=Domain Groups,DC=Domain,DC=co,DC=uk&#8221; -members | dsget user -upn -display -disabled -acctexpires</p></blockquote>
<p>This commnd above will list the users in the group <em>My Group</em> with there UPN, display name, if the account is disabled and when the account expires.</p>

	Tags: <a href="http://www.yeltuor.com/articles/tag/active-directory/" title="Active Directory" rel="tag">Active Directory</a>, <a href="http://www.yeltuor.com/articles/tag/cli/" title="CLI" rel="tag">CLI</a>, <a href="http://www.yeltuor.com/articles/tag/query/" title="Query" rel="tag">Query</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.yeltuor.com/articles/script/ad-command-line-queries/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Additional AD User Account Information</title>
		<link>http://www.yeltuor.com/articles/how-to/additional-ad-user-account-information/</link>
		<comments>http://www.yeltuor.com/articles/how-to/additional-ad-user-account-information/#comments</comments>
		<pubDate>Sun, 08 Feb 2009 21:54:55 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[How to]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[User]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.yeltuor.com/?p=27</guid>
		<description><![CDATA[There is a lot of information that Active Directory stores in its database that is not necessarily available through common tools such as Active Directory Users and Computers MMC.
With the Active Directory Users and Computers MMC installed, and by using part of Microsoft&#8217;s Account Lockout and Management Tool, extra user account information can be made [...]]]></description>
			<content:encoded><![CDATA[<p>There is a lot of information that Active Directory stores in its database that is not necessarily available through common tools such as <em>Active Directory Users and Computers</em> MMC.</p>
<p>With the Active Directory Users and Computers MMC installed, and by using part of Microsoft&#8217;s <a title="MS Account Lockout and Management Tools" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=7AF2E69C-91F3-4E63-8629-B999ADDE0B9E&amp;displaylang=en" target="_blank">Account Lockout and Management Tool</a>, extra user account information can be made accessible, this includes:</p>
<ul>
<li>Password last set time</li>
<li>Password expiry time</li>
<li>SID and GUID</li>
<li>Last Logon \ Logoff \ Bad Password time</li>
<li>Logon \ Bad Password count</li>
</ul>
<p><strong>NB:</strong> The last logon and logoff attributes within a Windows 2000 domain are <em>not</em> replicated between domain controllers&#8230; therefore not accurate. However this has been fixed with AD 2003 by adding another attribute into the schema called lastLogonTimestamp which <em>is </em>replicated.</p>
<p>The first step is to get the acctinfo.dll available from the above tool or here.</p>
<p>Next, copy the file to C:\WINDOWS\SYSTEM32 then run the command</p>
<blockquote><p><em>regsvr32 C:\WINDOWS\SYSTEM32\acctinfo.dll</em></p></blockquote>
<p>This will register the dll, when opening the Users and Computers console you will notice another tab called <em>Additional Account Info</em>. This is where the extra information is displayed.</p>

	Tags: <a href="http://www.yeltuor.com/articles/tag/active-directory/" title="Active Directory" rel="tag">Active Directory</a>, <a href="http://www.yeltuor.com/articles/tag/user/" title="User" rel="tag">User</a>, <a href="http://www.yeltuor.com/articles/tag/windows/" title="Windows" rel="tag">Windows</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.yeltuor.com/articles/how-to/additional-ad-user-account-information/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
