<?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>sheenaustin.com &#187; DSQuery</title>
	<atom:link href="http://www.sheenaustin.com/tag/dsquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sheenaustin.com</link>
	<description>my home on the interweb</description>
	<lastBuildDate>Wed, 21 Jul 2010 01:59:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>DSQuery Operating System Service Pack Version</title>
		<link>http://www.sheenaustin.com/2010/07/20/dsquery-operating-system-service-pack-version/</link>
		<comments>http://www.sheenaustin.com/2010/07/20/dsquery-operating-system-service-pack-version/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 01:59:27 +0000</pubDate>
		<dc:creator>Sheen</dc:creator>
				<category><![CDATA[Windows Scripting]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[DSQuery]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Service Pack]]></category>
		<category><![CDATA[Windows Server]]></category>

		<guid isPermaLink="false">http://www.sheenaustin.com/?p=199</guid>
		<description><![CDATA[I had a requirement recently to get the service pack versions for all workstations on the domain. I tried a few different options but the easiest option was to use the extremely useful dsquery tool. Without further ado, this is the command: dsquery * -scope subtree -attr &#8220;cn&#8221; &#8220;operatingSystem&#8221; &#8220;operatingSystemServicePack&#8221;  -filter &#8220;(&#38;(objectclass=computer)(objectcategory=computer)(operatingSystem=Windows XP*))&#8221; -limit 100000 [...]


Related posts:<ol><li><a href='http://www.sheenaustin.com/2009/05/18/get-list-of-machines-by-os-type-from-active-directory/' rel='bookmark' title='Permanent Link: Get list of machines by OS type from Active Directory'>Get list of machines by OS type from Active Directory</a></li>
<li><a href='http://www.sheenaustin.com/2009/05/19/diskpartexe-warning-when-expanding-drive/' rel='bookmark' title='Permanent Link: Diskpart.exe Warning when expanding drive'>Diskpart.exe Warning when expanding drive</a></li>
<li><a href='http://www.sheenaustin.com/2009/06/19/active-directory-password-expiry-reminder-email/' rel='bookmark' title='Permanent Link: Active Directory Password Expiry Reminder Email'>Active Directory Password Expiry Reminder Email</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I had a requirement recently to get the service pack versions for all workstations on the domain. I tried a few different options but the easiest option was to use the extremely useful dsquery tool.</p>
<p>Without further ado, this is the command:</p>
<blockquote><p>dsquery * -scope subtree -attr &#8220;cn&#8221; &#8220;operatingSystem&#8221; &#8220;operatingSystemServicePack&#8221;  -filter &#8220;(&amp;(objectclass=computer)(objectcategory=computer)(operatingSystem=Windows XP*))&#8221; -limit 100000</p></blockquote>
<p>The output of this command would be as follows:</p>
<p>cn                 operatingSystem                      operatingSystemServicePack<br />
WRK001    Windows XP Professional     Service Pack 1<br />
WRK002    Windows XP Professional     Service Pack 2<br />
WRK003    Windows XP Professional     Service Pack 3</p>
<p>Where, cn is the workstation name and the others are self explanatory.</p>
<p>Share your handy little tips and tricks!</p>


<p>Related posts:<ol><li><a href='http://www.sheenaustin.com/2009/05/18/get-list-of-machines-by-os-type-from-active-directory/' rel='bookmark' title='Permanent Link: Get list of machines by OS type from Active Directory'>Get list of machines by OS type from Active Directory</a></li>
<li><a href='http://www.sheenaustin.com/2009/05/19/diskpartexe-warning-when-expanding-drive/' rel='bookmark' title='Permanent Link: Diskpart.exe Warning when expanding drive'>Diskpart.exe Warning when expanding drive</a></li>
<li><a href='http://www.sheenaustin.com/2009/06/19/active-directory-password-expiry-reminder-email/' rel='bookmark' title='Permanent Link: Active Directory Password Expiry Reminder Email'>Active Directory Password Expiry Reminder Email</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.sheenaustin.com/2010/07/20/dsquery-operating-system-service-pack-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get list of machines by OS type from Active Directory</title>
		<link>http://www.sheenaustin.com/2009/05/18/get-list-of-machines-by-os-type-from-active-directory/</link>
		<comments>http://www.sheenaustin.com/2009/05/18/get-list-of-machines-by-os-type-from-active-directory/#comments</comments>
		<pubDate>Mon, 18 May 2009 08:19:19 +0000</pubDate>
		<dc:creator>Sheen</dc:creator>
				<category><![CDATA[Windows Server]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[DSQuery]]></category>
		<category><![CDATA[Windows Server 2003]]></category>

		<guid isPermaLink="false">http://www.sheenaustin.com/2009/05/18/get-list-of-machines-by-os-type-from-active-directory/</guid>
		<description><![CDATA[Here is an easy way of getting a list of computers that have a particular OS type from Active Directory using DSQuery. dsquery * domainroot -filter &#8220;(&#38;(objectCategory=computer)(operatingSystem=Windows XP*))&#8221; The command above would give you a list of all computers that have a Windows XP operating system. For Windows Servers, change the command as follows: dsquery [...]


Related posts:<ol><li><a href='http://www.sheenaustin.com/2010/07/20/dsquery-operating-system-service-pack-version/' rel='bookmark' title='Permanent Link: DSQuery Operating System Service Pack Version'>DSQuery Operating System Service Pack Version</a></li>
<li><a href='http://www.sheenaustin.com/2009/10/07/how-to-backup-and-restore-active-directory/' rel='bookmark' title='Permanent Link: How to Backup and Restore Active Directory'>How to Backup and Restore Active Directory</a></li>
<li><a href='http://www.sheenaustin.com/2009/05/04/active-directory-audit-script/' rel='bookmark' title='Permanent Link: Active Directory Audit Script'>Active Directory Audit Script</a></li>
<li><a href='http://www.sheenaustin.com/2009/06/19/active-directory-password-expiry-reminder-email/' rel='bookmark' title='Permanent Link: Active Directory Password Expiry Reminder Email'>Active Directory Password Expiry Reminder Email</a></li>
<li><a href='http://www.sheenaustin.com/2009/05/19/diskpartexe-warning-when-expanding-drive/' rel='bookmark' title='Permanent Link: Diskpart.exe Warning when expanding drive'>Diskpart.exe Warning when expanding drive</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Here is an easy way of getting a list of computers that have a particular OS type from Active Directory using DSQuery.</p>
<blockquote><p>dsquery * domainroot -filter &#8220;(&amp;(objectCategory=computer)(operatingSystem=Windows XP*))&#8221;</p></blockquote>
<p><span style="color: #000000;">The command above would give you a list of all computers that have a Windows XP operating system. For Windows Servers, change the command as follows:</span></p>
<blockquote><p>dsquery * domainroot -filter &#8220;(&amp;(objectCategory=computer)(operatingSystem=Windows Server*))&#8221;</p></blockquote>
<p>The output of the commands above would look something like this:</p>
<blockquote><p><span style="color: #000000;">samid</span></p>
<p><span style="color: #000000;">server1$</span></p>
<p><span style="color: #000000;">server2$</span></p>
<p><span style="color: #000000;">server3$</span></p>
<p><span style="color: #000000;">dsget succeeded</span></p></blockquote>
<p>Note the ‘samid’ at the head and ‘dsget succeeded’ at the end and the ‘$’ at the end tail of every server name.</p>
<p>If you are like me, and you would like just get a nice clean output with only server names, you can run this command:</p>
<p><span id="more-117"></span></p>
<blockquote><p>for /f &#8220;Tokens=1 delims=$&#8221; %a in (&#8216;dsquery * domainroot -filter &#8220;(&amp;(objectCategory=computer)(operatingSystem=Windows Server*))&#8221;^| dsget computer -samid^|find /V &#8220;samid&#8221; ^| find /V &#8220;dsget&#8221;&#8216;) do echo %a</p></blockquote>
<p>The output of the command shown above would be:</p>
<blockquote><p><span style="color: #000000;">server1</span></p>
<p><span style="color: #000000;">server2</span></p>
<p><span style="color: #000000;">server3</span></p></blockquote>
<p>… and can be used as input to a file or another command etc…</p>


<p>Related posts:<ol><li><a href='http://www.sheenaustin.com/2010/07/20/dsquery-operating-system-service-pack-version/' rel='bookmark' title='Permanent Link: DSQuery Operating System Service Pack Version'>DSQuery Operating System Service Pack Version</a></li>
<li><a href='http://www.sheenaustin.com/2009/10/07/how-to-backup-and-restore-active-directory/' rel='bookmark' title='Permanent Link: How to Backup and Restore Active Directory'>How to Backup and Restore Active Directory</a></li>
<li><a href='http://www.sheenaustin.com/2009/05/04/active-directory-audit-script/' rel='bookmark' title='Permanent Link: Active Directory Audit Script'>Active Directory Audit Script</a></li>
<li><a href='http://www.sheenaustin.com/2009/06/19/active-directory-password-expiry-reminder-email/' rel='bookmark' title='Permanent Link: Active Directory Password Expiry Reminder Email'>Active Directory Password Expiry Reminder Email</a></li>
<li><a href='http://www.sheenaustin.com/2009/05/19/diskpartexe-warning-when-expanding-drive/' rel='bookmark' title='Permanent Link: Diskpart.exe Warning when expanding drive'>Diskpart.exe Warning when expanding drive</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.sheenaustin.com/2009/05/18/get-list-of-machines-by-os-type-from-active-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
