<?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>vbscriptblog.com &#187; email</title>
	<atom:link href="http://vbscriptblog.com/tag/email/feed/" rel="self" type="application/rss+xml" />
	<link>http://vbscriptblog.com</link>
	<description>Scripting for Windows Sysadmins</description>
	<lastBuildDate>Mon, 16 Jan 2012 09:41:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Active Directory and WMI: VBscript to enumerate a sorted list of all mailboxes and their size in your AD domain</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/email/active-directory-and-wmi-vbscript-to-enumerate-a-sorted-list-of-all-mailboxes-and-their-size-in-your-ad-domain/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/email/active-directory-and-wmi-vbscript-to-enumerate-a-sorted-list-of-all-mailboxes-and-their-size-in-your-ad-domain/#comments</comments>
		<pubDate>Tue, 17 May 2011 12:35:48 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[email]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[mailbox]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[smtp address]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=1040</guid>
		<description><![CDATA[Today&#8217;s script is made for Gavin. It is an extension of my previous script to enumerate all Exchange mailboxes and their size. Gavin asked for a sorted list based on mailbox size. My first attempt was to use the VB Arraylist object (.Net needed on the script machine). Here&#8217;s an Arraylist example by Rob van [...]]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s script is made for <a href="http://deludi.nl/blog/vbscript/active-directory/exchange-active-directory-vbscript/active-directory-and-wmi-vbscript-to-enumerate-all-mailboxes-and-their-size-of-your-ad-domain/">Gavin</a>.<br />
It is an extension of my previous script to enumerate all Exchange mailboxes and their size.<br />
Gavin asked for a sorted list based on mailbox size.</p>
<p>My first attempt was to use the VB Arraylist object (.Net needed on the script machine).<br />
Here&#8217;s an <a href="http://www.robvanderwoude.com/vbstech_data_arraylist.php">Arraylist example</a> by Rob van der Woude.<br />
The problem with the Arraylist object is that it is not made for sorting multi dimensional arrays.<br />
I can do some tricks by concatenating all values to a superstring.<br />
The problem is that sorting an Arraylist with superstrings will be next to impossible.</p>
<p>Luckily I found a better solution by using a <a href="http://sogeeky.blogspot.com/2006/08/vbscript-using-disconnected-recordset.html">disconnected recordset<br />
</a> (= a recordset without database connection).<br />
One thing to check is to use the <a href="http://www.w3schools.com/ado/prop_field_type.asp#datatypeenum">right datatype</a> for each variable.<br />
I declared the &#8220;size&#8221; variable as a &#8220;double precision floating point&#8221;.<br />
The other 2 were delared as &#8220;null-terminated character strings&#8221;.<br />
With the disconnected recordset you can do a lot of funky stuff like sorting, filtering and so on.<br />
I will certainly use the disconnected recordset object in new scripts.</p>
<p>I have tested the script in a large environment (~ 8500 mailboxes).<br />
It worked flawless (okay I had to test and modify it for half an hour or so).</p>
<p>What the script does:</p>
<ul>
<li>get all exchange servers from your AD domain</li>
<li>make a wmi connection to each server and create a list of the mailboxes and their size</li>
<li>put all values in a disconnected recordset, sort and output to the screen</li>
</ul>
<p>The script is tested in a win2003/exchange2003 environment.</p>
<p>Follow the next steps to run the script  (admin rights needed):</p>
<ul>
<li>copy and paste the script in your favorite text editor</li>
<li>save the script (for example c:tempsortedlistofallmailboxes.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript sortedlistofallmailboxes.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : sortedlistofallmailboxes.vbs
' Description : script to enumerate all mailboxes and their size in your AD domain
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 17-05-2011
' Level: intermediate

Set DataList = CreateObject(&quot;ADOR.Recordset&quot;)
DataList.Fields.Append &quot;Servername&quot;, 200, 255
DataList.Fields.Append &quot;DisplayName&quot;, 200, 255
DataList.Fields.Append &quot;Size&quot;, 5
DataList.Open

Set adoCommand = CreateObject(&quot;ADODB.Command&quot;)
Set adoConnection = CreateObject(&quot;ADODB.Connection&quot;)
adoConnection.Provider = &quot;ADsDSOObject&quot;
adoConnection.Open &quot;Active Directory Provider&quot;
adoCommand.ActiveConnection = adoConnection

Set objRootDSE = GetObject(&quot;LDAP://RootDSE&quot;)
strBase = &quot;&lt;LDAP://&quot; &amp; objRootDSE.Get(&quot;configurationnamingcontext&quot;) &amp; &quot;&gt;&quot;
strFilter = &quot;(objectCategory=msExchExchangeServer)&quot;
strAttributes = &quot;name&quot;

strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes &amp; &quot;;subtree&quot;
adoCommand.CommandText = strQuery
adoCommand.Properties(&quot;Page Size&quot;) = 100
adoCommand.Properties(&quot;Timeout&quot;) = 3
adoCommand.Properties(&quot;Cache Results&quot;) = False

Set adoRecordset = adoCommand.Execute

Do Until adoRecordset.EOF
 Set objWMIExchange = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!//&quot;&amp;_
 adoRecordset.Fields(&quot;name&quot;).Value &amp; &quot;/root/MicrosoftExchangeV2&quot;)
 Set colExchangeMailboxes = objWMIExchange.InstancesOf(&quot;Exchange_Mailbox&quot;)
 For Each objExchangeMailbox in colExchangeMailboxes
 If Left(objExchangeMailbox.StorageGroupName, 5) &lt;&gt; &quot;Recov&quot; Then
 DataList.AddNew
 DataList(&quot;Servername&quot;) = adoRecordset.Fields(&quot;name&quot;).Value
 DataList(&quot;DisplayName&quot;) = objExchangeMailbox.MailboxDisplayName
 DataList(&quot;Size&quot;) = Round(objExchangeMailbox.Size/1024,0)
 Datalist.Update
 End If
 Next
 Set colExchange_Mailboxes = Nothing
 Set objWMIExchange = Nothing
 adoRecordset.MoveNext
Loop

adoRecordset.Close
adoConnection.Close

Set adoRecordset = Nothing
Set objRootDSE = Nothing
Set adoConnection = Nothing
Set adoCommand = Nothing

DataList.Sort = &quot;Size DESC&quot;
DataList.MoveFirst

Do Until DataList.EOF
 Wscript.Echo DataList.Fields.Item(&quot;Size&quot;) &amp; &quot; MB ; &quot; &amp; DataList.Fields.Item(&quot;DisplayName&quot;) &amp; &quot; ; &quot; &amp;_
 DataList.Fields.Item(&quot;Servername&quot;)
 DataList.MoveNext
Loop

Datalist.Close
Set DataList = Nothing
</pre>
<p>When you have problems/questions please post a reply or give a &#8216;star&#8217; rating.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Factive-directory%2Femail%2Factive-directory-and-wmi-vbscript-to-enumerate-a-sorted-list-of-all-mailboxes-and-their-size-in-your-ad-domain%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/active-directory/email/active-directory-and-wmi-vbscript-to-enumerate-a-sorted-list-of-all-mailboxes-and-their-size-in-your-ad-domain/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/active-directory/email/active-directory-and-wmi-vbscript-to-enumerate-a-sorted-list-of-all-mailboxes-and-their-size-in-your-ad-domain/"  data-text="Active Directory and WMI: VBscript to enumerate a sorted list of all mailboxes and their size in your AD domain" data-count="horizontal" data-via="dirkadamsky">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/active-directory/email/active-directory-and-wmi-vbscript-to-enumerate-a-sorted-list-of-all-mailboxes-and-their-size-in-your-ad-domain/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/email/active-directory-and-wmi-vbscript-to-enumerate-a-sorted-list-of-all-mailboxes-and-their-size-in-your-ad-domain/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>VBscript and WMI: VBscript to enumerate all mailboxes on a given Exchange server</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/vbscript-and-wmi-vbscript-to-enumerate-all-mailboxes-on-a-given-exchange-server/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/vbscript-and-wmi-vbscript-to-enumerate-all-mailboxes-on-a-given-exchange-server/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 13:07:47 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[exchange]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[adsi]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=911</guid>
		<description><![CDATA[This script is made for Jeff Doty. What the script does: make a wmi connection to a given exchange server and create a list of the mailboxes and their size The script is tested in an win2003/exchange2003 environment. Follow the next steps to run the script (admin rights needed): copy and paste the script in [...]]]></description>
			<content:encoded><![CDATA[<p>This script is made for <a href="http://deludi.nl/blog/vbscript/active-directory/exchange-active-directory-vbscript/active-directory-and-wmi-vbscript-to-enumerate-all-mailboxes-and-their-size-of-your-ad-domain/comment-page-1/#comment-328">Jeff Doty</a>.</p>
<p>What the script does:</p>
<ul>
<li>make a wmi connection to a given exchange server and create a list of the mailboxes and their size</li>
</ul>
<p>The script is tested in an win2003/exchange2003 environment.</p>
<p>Follow the next steps to run the script  (admin rights needed):</p>
<ul>
<li>copy and paste the script in your favorite text editor</li>
<li>replace the string &#8216;srv001&#8242; with the name of your exchange server</li>
<li>save the script (for example c:tempmailboxes.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript mailboxes.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>When you want the output in a file please give this command:</p>
<p>&#8220;cscript mailboxes.vbs &gt; mailboxes.txt&#8221; (again without the quotes)</p>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : mailboxes.vbs
' Description : script to enumerate all mailboxes on a given Exchange server
' Author : dirk adamsky - deludi bv
' Version : 1.10 (changed/corrected based on input by Mike)
' Date : 23-03-2011
' Level: intermediate

strServer = &quot;srv001&quot;
Const MinimalSize = 2048 'size in MB
Set objWMIExchange = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!//&quot; &amp; strServer &amp; &quot;/root/MicrosoftExchangeV2&quot;)
Set colExchangeMailboxes = objWMIExchange.InstancesOf(&quot;Exchange_Mailbox&quot;)
For Each objExchangeMailbox in colExchangeMailboxes
    If (Left(objExchangeMailbox.StorageGroupName, 5) &lt;&gt; &quot;Recov&quot;) And (Round(objExchangeMailbox.Size/1024,0) &gt; MinimalSize) Then
		Wscript.Echo objExchangeMailbox.MailboxDisplayName &amp; &quot; ; &quot; &amp;_
			Round(objExchangeMailbox.Size/1024,0) &amp; &quot; MB&quot;
	End If
Next
Set colExchange_Mailboxes = Nothing
Set objWMIExchange = Nothing
</pre>
<p>When you have problems/questions please post a reply or give a &#8216;star&#8217; rating.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Factive-directory%2Fexchange-active-directory-vbscript%2Fvbscript-and-wmi-vbscript-to-enumerate-all-mailboxes-on-a-given-exchange-server%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/vbscript-and-wmi-vbscript-to-enumerate-all-mailboxes-on-a-given-exchange-server/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/vbscript-and-wmi-vbscript-to-enumerate-all-mailboxes-on-a-given-exchange-server/"  data-text="VBscript and WMI: VBscript to enumerate all mailboxes on a given Exchange server" data-count="horizontal" data-via="dirkadamsky">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/vbscript-and-wmi-vbscript-to-enumerate-all-mailboxes-on-a-given-exchange-server/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/vbscript-and-wmi-vbscript-to-enumerate-all-mailboxes-on-a-given-exchange-server/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Active Directory: VBscript to enumerate all contacts in your domain</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/contacts/active-directory-vbscript-to-enumerate-all-contacts-in-your-domain/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/contacts/active-directory-vbscript-to-enumerate-all-contacts-in-your-domain/#comments</comments>
		<pubDate>Fri, 14 Jan 2011 14:01:05 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[contacts]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[smtp address]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=903</guid>
		<description><![CDATA[This is my first post for 2011. Last week I had to do some work on Active Directory contacts. For a starter I made a script that enumerates all contacts in Active Directory. Be careful: this script does not include your local contact (they are a part of your mailbox). The script is straight ahead: [...]]]></description>
			<content:encoded><![CDATA[<p>This is my first post for 2011.</p>
<p>Last week I had to do some work on Active Directory contacts.<br />
For a starter I made a script that enumerates all contacts in Active Directory.<br />
Be careful: this script does not include your local contact (they are a part of your mailbox).<br />
The script is straight ahead: ADO query, filter on &#8216;objectclass=contacts&#8217; and off you go.</p>
<p>Follow the next steps to run the script (no admin rights needed):</p>
<p>* open your favorite text editor<br />
* copy and paste the script into the editor<br />
* save the script (for example c:tempenumeratecontacts.vbs)<br />
* open a command prompt<br />
* go to &#8220;c:temp&#8221;<br />
* give &#8220;cscript enumeratecontacts.vbs&#8221; (without quotes) and enter</p>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : enumeratecontacts.vbs
' Description : script to enumerate all contacts in your domain
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 14-01-2011
' Level: beginner

Set adoCommand = CreateObject(&quot;ADODB.Command&quot;)
Set adoConnection = CreateObject(&quot;ADODB.Connection&quot;)
adoConnection.Provider = &quot;ADsDSOObject&quot;
adoConnection.Open &quot;Active Directory Provider&quot;
adoCommand.ActiveConnection = adoConnection
Set objRootDSE = GetObject(&quot;LDAP://RootDSE&quot;)
strDNSDomain = objRootDSE.Get(&quot;defaultNamingContext&quot;)
strBase = &quot;&lt;LDAP://&quot; &amp; strDNSDomain &amp; &quot;&gt;&quot;
strFilter = &quot;(objectClass=contact)&quot;
strAttributes = &quot;displayname, mail&quot;
strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes &amp; &quot;;subtree&quot;
adoCommand.CommandText = strQuery
adoCommand.Properties(&quot;Page Size&quot;) = 100
adoCommand.Properties(&quot;Timeout&quot;) = 30
adoCommand.Properties(&quot;Cache Results&quot;) = False

Set adoRecordset = adoCommand.Execute

Do Until adoRecordset.EOF
 Wscript.echo adoRecordset.Fields(&quot;displayname&quot;).Value &amp; &quot; ; &quot; &amp; adoRecordset.Fields(&quot;mail&quot;).Value
 adoRecordset.MoveNext
Loop

adoRecordset.Close
adoConnection.Close

Set adoConnection = Nothing
Set adoCommand = Nothing
</pre>
<p>When you have problems/questions with the script please post a reply.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Factive-directory%2Fcontacts%2Factive-directory-vbscript-to-enumerate-all-contacts-in-your-domain%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/active-directory/contacts/active-directory-vbscript-to-enumerate-all-contacts-in-your-domain/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/active-directory/contacts/active-directory-vbscript-to-enumerate-all-contacts-in-your-domain/"  data-text="Active Directory: VBscript to enumerate all contacts in your domain" data-count="horizontal" data-via="dirkadamsky">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/active-directory/contacts/active-directory-vbscript-to-enumerate-all-contacts-in-your-domain/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/contacts/active-directory-vbscript-to-enumerate-all-contacts-in-your-domain/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Active Directory: VBscript to enumerate the message restrictions (send to rights) of a user or distributiongroup v2</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/messagerestrictions/active-directory-vbscript-to-enumerate-the-message-restrictions-send-to-rights-of-a-user-or-distributiongroup/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/messagerestrictions/active-directory-vbscript-to-enumerate-the-message-restrictions-send-to-rights-of-a-user-or-distributiongroup/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 12:08:01 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[messagerestrictions]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[distribution group]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[groups]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[memberships]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[smtp address]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=684</guid>
		<description><![CDATA[Suffering from a lack of inspiration I decided to rework a previous script. I had a request on my previous messagerestriction script. Added to the script is the option to enter the smtp address of the user or group object for which the messagerestrictions are set. I have done that by re-using code from this [...]]]></description>
			<content:encoded><![CDATA[<p>Suffering from a lack of inspiration I decided to rework a previous script.<br />
I had a request on my previous <a href="http://deludi.nl/blog/vbscript/active-directory/messagerestrictions/active-directory-vbscript-to-enumerate-the-message-restrictions-send-to-rights-of-a-distributionlist/comment-page-1/#comment-104">messagerestriction script</a>.<br />
Added to the script is the option to enter the smtp address of<br />
the user or group object for which the messagerestrictions are set.<br />
I have done that by re-using code from <a href="http://deludi.nl/blog/vbscript/active-directory/active-directory-vbscript-to-change-the-groups-from-a-user-based-on-an-example-user/">this script</a>.<br />
Another question was the option to output to a file,<br />
this can be done easily by running the script like this:</p>
<p>cscript enumeratesendtorights.vbs > thefilenameofyourchoice.txt.</p>
<p>Follow the next steps to run the script (no admin rights needed):</p>
<p>* find the distinguished name of the nested group (adsiedit.msc)<br />
* open your favorite text editor<br />
* copy and paste the script into the editor<br />
* change the distinguished name<br />
* save the script (for example c:tempenumeratesendtorights.vbs)<br />
* open a command prompt<br />
* go to &#8220;c:temp&#8221;<br />
* give &#8220;cscript enumeratesendtorights.vbs&#8221; (without quotes) and enter</p>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : enumeratesendtorights.vbs
' Description : script to enumerate the message restrictions (send to rights) of a distributionlist
' Author : dirk adamsky - deludi bv
' Version : 2.00 added smtp input option based on input from M (see comments on previous script)
' Date : 20-08-2010 (v.1.00 date 08-02-2010)
' Level: advanced

strObject = InputBox(&quot;Please enter the smtp address&quot;)
Set objSource = GetObject(&quot;LDAP://&quot; &amp; GetDN(strObject))
If TypeName(objSource.authOrig) = &quot;String&quot; Then
	GetSendToRights (&quot;LDAP://&quot; &amp; objSource.authOrig)
Else
	For Each User In objSource.authOrig
		GetSendToRights (&quot;LDAP://&quot; &amp; User)
	Next
End If
If TypeName(objSource.dLMemSubmitPerms) = &quot;String&quot; Then
	EnumNestedgroup objSource.dLMemSubmitPerms
Else
	For Each Group in objSource.dLMemSubmitPerms
		EnumNestedgroup Group
	Next
End If
Set objSource = Nothing

Function GetDN(strMail)
	Set adoCommand = CreateObject(&quot;ADODB.Command&quot;)
	Set adoConnection = CreateObject(&quot;ADODB.Connection&quot;)
	adoConnection.Provider = &quot;ADsDSOObject&quot;
	adoConnection.Open &quot;Active Directory Provider&quot;
	adoCommand.ActiveConnection = adoConnection
	Set objRootDSE = GetObject(&quot;LDAP://RootDSE&quot;)
	strBase = &quot;&lt;LDAP://&quot; &amp; objRootDSE.Get(&quot;defaultNamingContext&quot;) &amp; &quot;&gt;&quot;

	' Filter on user objects.
	strFilter = &quot;(mail=&quot; &amp;  strMail &amp; &quot;)&quot;

	' Comma delimited list of attribute values to retrieve.
	strAttributes = &quot;distinguishedName&quot;

	' Construct the LDAP syntax query.
	strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes &amp; &quot;;subtree&quot;
	adoCommand.CommandText = strQuery
	adoCommand.Properties(&quot;Page Size&quot;) = 100
	adoCommand.Properties(&quot;Timeout&quot;) = 30
	adoCommand.Properties(&quot;Cache Results&quot;) = False
	Set adoRecordset = adoCommand.Execute
	wscript.echo adoRecordset.Fields(&quot;distinguishedName&quot;).Value
	GetDN = adoRecordset.Fields(&quot;distinguishedName&quot;).Value
	adoRecordset.Close
	adoConnection.Close

	Set adoRecordset = Nothing
	Set objRootDSE = Nothing
	Set adoConnection = Nothing
	Set adoCommand = Nothing

End Function

Function GetSendToRights(strUserDN)
	On Error Resume Next
	Set objAccount = GetObject(strUserDN)
	Wscript.Echo objAccount.Mail &amp; &quot; ; &quot; &amp; objAccount.DisplayName &amp; &quot; ; direct send to rights&quot;
	Set objSecurityDescriptor = objAccount.Get(&quot;ntSecurityDescriptor&quot;)
	Set objDacl = objSecurityDescriptor.DiscretionaryAcl
	Set objAce = CreateObject(&quot;AccessControlEntry&quot;)
	For Each objAce In objDacl
		If objAce.ObjectType = &quot;{AB721A54-1E2F-11D0-9819-00AA0040529B}&quot; Then
			If (Left(objAce.Trustee,3) &lt;&gt; &quot;S-1&quot; And objAce.Trustee &lt;&gt; &quot;NT AUTHORITYSELF&quot;) Then
				GetUserDetails Mid(objAce.Trustee,9)
			End If
		End If
	Next
End Function

Function GetUserDetails(strPreW2K)
	Set adoCommand = CreateObject(&quot;ADODB.Command&quot;)
	Set adoConnection = CreateObject(&quot;ADODB.Connection&quot;)
	adoConnection.Provider = &quot;ADsDSOObject&quot;
	adoConnection.Open &quot;Active Directory Provider&quot;
	adoCommand.ActiveConnection = adoConnection

	' Search entire Active Directory domain.
	Set objRootDSE = GetObject(&quot;LDAP://RootDSE&quot;)
	strDNSDomain = objRootDSE.Get(&quot;defaultNamingContext&quot;)
	strBase = &quot;&lt;LDAP://&quot; &amp; strDNSDomain &amp; &quot;&gt;&quot;

	' Filter on user objects.
	strFilter = &quot;(&amp;(objectCategory=person)(objectClass=user)(sAMAccountName=&quot; &amp;  strPreW2K &amp; &quot;))&quot;

	' Comma delimited list of attribute values to retrieve.
	strAttributes = &quot;mail, displayname&quot;

	' Construct the LDAP syntax query.
	strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes &amp; &quot;;subtree&quot;
	adoCommand.CommandText = strQuery
	adoCommand.Properties(&quot;Page Size&quot;) = 100
	adoCommand.Properties(&quot;Timeout&quot;) = 30
	adoCommand.Properties(&quot;Cache Results&quot;) = False

	' Run the query.
	Set adoRecordset = adoCommand.Execute
	Wscript.Echo adoRecordset.Fields(&quot;mail&quot;).Value &amp; &quot; ; &quot; &amp; adoRecordset.Fields(&quot;displayname&quot;).Value &amp; &quot; ; indirect send to rights&quot;
	' Clean up.
	adoRecordset.Close
	adoConnection.Close

	Set adoRecordset = Nothing
	Set objRootDSE = Nothing
	Set adoConnection = Nothing
	Set adoCommand = Nothing
End Function	

Sub EnumNestedgroup(strGroupDN)
	Set objGroup = GetObject(&quot;LDAP://&quot; &amp; strGroupDN)
	For Each objMember in objGroup.Members
		If (LCase(objMember.Class) = &quot;group&quot;) Then
			Call EnumNestedgroup(objMember.AdsPath)
		Else
			GetSendToRights objMember.AdsPath
		End If
	Next
	Set objGroup = Nothing
End Sub
</pre>
<p>When you have problems/questions with the script please post a reply.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Factive-directory%2Fmessagerestrictions%2Factive-directory-vbscript-to-enumerate-the-message-restrictions-send-to-rights-of-a-user-or-distributiongroup%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/active-directory/messagerestrictions/active-directory-vbscript-to-enumerate-the-message-restrictions-send-to-rights-of-a-user-or-distributiongroup/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/active-directory/messagerestrictions/active-directory-vbscript-to-enumerate-the-message-restrictions-send-to-rights-of-a-user-or-distributiongroup/"  data-text="Active Directory: VBscript to enumerate the message restrictions (send to rights) of a user or distributiongroup v2" data-count="horizontal" data-via="dirkadamsky">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/active-directory/messagerestrictions/active-directory-vbscript-to-enumerate-the-message-restrictions-send-to-rights-of-a-user-or-distributiongroup/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/messagerestrictions/active-directory-vbscript-to-enumerate-the-message-restrictions-send-to-rights-of-a-user-or-distributiongroup/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Active Directory: VBscript to enumerate all distribution groups that are hidden in the Global Address List</title>
		<link>http://vbscriptblog.com/vbscript/active-directory-vbscript-to-enumerate-all-distribution-groups-that-are-hidden-in-the-global-addres-list/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory-vbscript-to-enumerate-all-distribution-groups-that-are-hidden-in-the-global-addres-list/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 06:48:58 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[active directory]]></category>
		<category><![CDATA[distributiongroups]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[groups]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[smtp address]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbs]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=670</guid>
		<description><![CDATA[The next script for today enumerates all hidden distribution groups. This is done by an ADO query with a filter on groups, msExchHideFromAddressLists and mail property. Follow the next steps to run the script (no admin rights needed): copy and paste the script in your favorite text editor save the script (for example c:temphidden-distribution-groups.vbs) open [...]]]></description>
			<content:encoded><![CDATA[<p>The next script for today enumerates all hidden distribution groups.<br />
This is done by an ADO query with a filter on groups, msExchHideFromAddressLists and mail property.  </p>
<p>Follow the next steps to run the script  (no admin rights needed):</p>
<ul>
<li>copy and paste the script in your favorite text editor</li>
<li>save the script (for example c:temphidden-distribution-groups.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript hidden-distribution-groups.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : hidden-distribution-groups.vbs
' Description : script to enumerate all distribution groups that are hidden in the Global Address List
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 15-07-2010
' Level: intermediate

Set adoCommand = CreateObject(&quot;ADODB.Command&quot;)
Set adoConnection = CreateObject(&quot;ADODB.Connection&quot;)
adoConnection.Provider = &quot;ADsDSOObject&quot;
adoConnection.Open &quot;Active Directory Provider&quot;
adoCommand.ActiveConnection = adoConnection

Set objRootDSE = GetObject(&quot;LDAP://RootDSE&quot;)
strBase = &quot;&lt;LDAP://&quot; &amp; objRootDSE.Get(&quot;defaultNamingContext&quot;) &amp; &quot;&gt;&quot;
strFilter = &quot;(&amp;(objectCategory=group)(msExchHideFromAddressLists=TRUE)(mail=*))&quot;
strAttributes = &quot;displayname, mail, msExchHideFromAddressLists&quot;

strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes &amp; &quot;;subtree&quot;
adoCommand.CommandText = strQuery
adoCommand.Properties(&quot;Page Size&quot;) = 100
adoCommand.Properties(&quot;Timeout&quot;) = 30
adoCommand.Properties(&quot;Cache Results&quot;) = False

Set objRecordset = adoCommand.Execute

objRecordSet.MoveFirst
Do Until objRecordSet.EOF
	Wscript.Echo objRecordSet.Fields(&quot;displayname&quot;).Value &amp; &quot; ; &quot; &amp; objRecordSet.Fields(&quot;mail&quot;).Value
	objRecordSet.MoveNext
Loop

Set objRecordset = Nothing
Set objRootDSE = Nothing
Set adoConnection = Nothing
Set adoCommand = Nothing
</pre>
<p>When you have problems/questions please post a reply or give a &#8216;star&#8217; rating.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV </p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Factive-directory-vbscript-to-enumerate-all-distribution-groups-that-are-hidden-in-the-global-addres-list%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/active-directory-vbscript-to-enumerate-all-distribution-groups-that-are-hidden-in-the-global-addres-list/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/active-directory-vbscript-to-enumerate-all-distribution-groups-that-are-hidden-in-the-global-addres-list/"  data-text="Active Directory: VBscript to enumerate all distribution groups that are hidden in the Global Address List" data-count="horizontal" data-via="dirkadamsky">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/active-directory-vbscript-to-enumerate-all-distribution-groups-that-are-hidden-in-the-global-addres-list/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory-vbscript-to-enumerate-all-distribution-groups-that-are-hidden-in-the-global-addres-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active Directory: VBscript to enumerate the local users of all servers in your domain</title>
		<link>http://vbscriptblog.com/various/active-directory-vbscript-to-enumerate-the-local-users-of-all-servers-in-your-domain/</link>
		<comments>http://vbscriptblog.com/various/active-directory-vbscript-to-enumerate-the-local-users-of-all-servers-in-your-domain/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 14:01:30 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[Various]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[alive]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=606</guid>
		<description><![CDATA[This script enumerates the local users of all servers (domain controllers are excluded) in your domain. The results are logged in a file and send with CDO mail. You can also schedule the script for monitoring purposes. Follow the next steps to run the script (admin rights needed): copy and paste the script in your [...]]]></description>
			<content:encoded><![CDATA[<p>This script enumerates the local users of all servers (domain controllers are excluded) in your domain.<br />
The results are logged in a file and send with CDO mail.<br />
You can also schedule the script for monitoring purposes.</p>
<p>Follow the next steps to run the script  (admin rights needed):</p>
<ul>
<li>copy and paste the script in your favorite text editor</li>
<li>change the smtp addresses of the sender and the recipient to your addresses</li>
<li>save the script (for example c:templocalusers.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript localusers.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : localusers.vbs
' Description : script to enumerate the local users of all servers in your domain
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 10-06-2010
' Level: intermediate

strDate = Replace(Date,&quot;/&quot;,&quot;-&quot;)
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
strCurrentDir = objFSO.GetAbsolutePathName(&quot;.&quot;)
Set objFSO = Nothing

Set adoCommand = CreateObject(&quot;ADODB.Command&quot;)
Set adoConnection = CreateObject(&quot;ADODB.Connection&quot;)
adoConnection.Provider = &quot;ADsDSOObject&quot;
adoConnection.Open &quot;Active Directory Provider&quot;
adoCommand.ActiveConnection = adoConnection

Set objRootDSE = GetObject(&quot;LDAP://RootDSE&quot;)
strDNSDomain = objRootDSE.Get(&quot;defaultNamingContext&quot;)
strBase = &quot;&lt;LDAP://&quot; &amp; strDNSDomain &amp; &quot;&gt;&quot;

strFilter = &quot;(&amp;(objectCategory=computer)(operatingSystem=*server*))&quot;

strAttributes = &quot;name,distinguishedName&quot;
strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes &amp; &quot;;subtree&quot;
adoCommand.CommandText = strQuery
adoCommand.Properties(&quot;Page Size&quot;) = 100
adoCommand.Properties(&quot;Timeout&quot;) = 30
adoCommand.Properties(&quot;Cache Results&quot;) = False
Set adoRecordset = adoCommand.Execute

Do Until adoRecordset.EOF
	strHostname = adoRecordset.Fields(&quot;name&quot;).Value
	If CheckStatus(strHostname) = True Then
		If Instr(adoRecordset.Fields(&quot;distinguishedName&quot;).Value,&quot;Domain Controllers&quot;) = 0 Then
			Set objGroup = GetObject(&quot;WinNT://&quot; &amp; strHostname &amp; &quot;/Users,group&quot;)
			For Each Member In objGroup.Members
				If Lcase(Member.Name) &lt;&gt; &quot;interactive&quot; And Lcase(Member.Name) &lt;&gt; &quot;authenticated users&quot; Then
			 		Logprint strHostname &amp; &quot; has &quot; &amp; Member.Name &amp; &quot; in the local users group&quot;
				End If
			Next
			Set objGroup = Nothing
		End If
	End If
	adoRecordset.MoveNext
Loop

Sendmail &quot;recipient@test.org&quot;, &quot;localusers&quot;, &quot;see attachment for details&quot;, strCurrentDir &amp; &quot;&quot; &amp; strDate &amp; &quot;-localusers.csv&quot;

Set adoRecordset = Nothing
Set objRootDSE = Nothing
Set adoConnection = Nothing
Set adoCommand = Nothing

Function CheckStatus(strAddress)
	Dim objPing, objRetStatus
	Set objPing = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}&quot;).ExecQuery _
      (&quot;select * from Win32_PingStatus where address = '&quot; &amp; strAddress &amp; &quot;'&quot;)
	For Each objRetStatus In objPing
        If IsNull(objRetStatus.StatusCode) Or objRetStatus.StatusCode &lt;&gt; 0 Then
			CheckStatus = False
        Else
			CheckStatus = True
        End If
    Next
	Set objPing = Nothing
End Function

Function LogPrint(Message)
Const ForAppending = 8
	Set ObjFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	Set objTextFile = ObjFSO.OpenTextFile(strDate &amp; &quot;-localusers.csv&quot;, ForAppending, True)
    objTextFile.WriteLine Message
    objTextFile.Close
	Set objTextFile = Nothing
	Set ObjFSO = Nothing
End Function

Function SendMail(strRecipient, strHeader, strBody, strAttachment)
	Set objMessage = CreateObject(&quot;CDO.Message&quot;)
		objMessage.Subject = strHeader
		objMessage.From = &quot;sender@test.org&quot;
		objMessage.To = strRecipient
		objMessage.TextBody = strBody
		objMessage.AddAttachment strAttachment
		objMessage.Configuration.Fields.Item (&quot;http://schemas.microsoft.com/cdo/configuration/sendusing&quot;) = 2
		objMessage.Configuration.Fields.Item (&quot;http://schemas.microsoft.com/cdo/configuration/smtpserver&quot;) = &quot;mail.domstad.org&quot;
		objMessage.Configuration.Fields.Item (&quot;http://schemas.microsoft.com/cdo/configuration/smtpserverport&quot;) = 25
		objMessage.Configuration.Fields.Item (&quot;http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout&quot;) = 60
		objMessage.Configuration.Fields.Update
		objMessage.Send
		Set objMessage = Nothing
End Function
</pre>
<p>When you have problems/questions please post a reply or give a &#8216;star&#8217; rating.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvarious%2Factive-directory-vbscript-to-enumerate-the-local-users-of-all-servers-in-your-domain%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/various/active-directory-vbscript-to-enumerate-the-local-users-of-all-servers-in-your-domain/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/various/active-directory-vbscript-to-enumerate-the-local-users-of-all-servers-in-your-domain/"  data-text="Active Directory: VBscript to enumerate the local users of all servers in your domain" data-count="horizontal" data-via="dirkadamsky">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/various/active-directory-vbscript-to-enumerate-the-local-users-of-all-servers-in-your-domain/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/various/active-directory-vbscript-to-enumerate-the-local-users-of-all-servers-in-your-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active Directory and WMI: VBscript to show the size of a specific mailbox</title>
		<link>http://vbscriptblog.com/vbscript/active-directory-and-wmi-vbscript-to-show-the-size-of-a-specific-mailbox/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory-and-wmi-vbscript-to-show-the-size-of-a-specific-mailbox/#comments</comments>
		<pubDate>Tue, 18 May 2010 14:07:06 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[active directory]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[wmi]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[mailbox]]></category>
		<category><![CDATA[smtp address]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbs]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=590</guid>
		<description><![CDATA[Today I made a script as requested by Jamal. It is a further development of a script to enumerate all exchange mailboxes and their size which can be found here. What the script does: ask for the smtp address of the mailbox get the displayname and homembd properties of that mailbox enumerate all exchange servers [...]]]></description>
			<content:encoded><![CDATA[<p>Today I made a script as requested by Jamal.<br />
It is a further development of a script to enumerate all exchange mailboxes and their size which can be found <a href="http://deludi.nl/blog/vbscript/active-directory/exchange-active-directory-vbscript/active-directory-and-wmi-vbscript-to-enumerate-all-mailboxes-and-their-size-of-your-ad-domain/#comments">here</a>.</p>
<p>What the script does:</p>
<ul>
<li>ask for the smtp address of the mailbox</li>
<li>get the displayname and homembd properties of that mailbox</li>
<li>enumerate all exchange servers</li>
<li>make a wmi connection with the exchange server on which the mailbox resides</li>
<li>get the size of the mailbox</li>
</ul>
<p>The script is tested in an win2003/exchange2003 environment.</p>
<p>Follow the next steps to run the script  (admin rights needed):</p>
<ul>
<li>copy and paste the script in your favorite text editor</li>
<li>save the script (for example c:tempmailboxsize.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript mailboxsize.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : mailboxsize.vbs
' Description : script to show the size of a specific mailbox
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 18-05-2010
' Level: advanced

Dim strDisplayName, strHomeMDB
strSMTP = InputBox(&quot;Please fill in the SMTP address of the user&quot;)
GetDisplayNameAndHomeMDB(strSMTP)

Set adoCommand = CreateObject(&quot;ADODB.Command&quot;)
Set adoConnection = CreateObject(&quot;ADODB.Connection&quot;)
adoConnection.Provider = &quot;ADsDSOObject&quot;
adoConnection.Open &quot;Active Directory Provider&quot;
adoCommand.ActiveConnection = adoConnection

Set objRootDSE = GetObject(&quot;LDAP://RootDSE&quot;)
strBase = &quot;&lt;LDAP://&quot; &amp; objRootDSE.Get(&quot;configurationnamingcontext&quot;) &amp; &quot;&gt;&quot;
strFilter = &quot;(objectCategory=msExchExchangeServer)&quot;
strAttributes = &quot;name&quot;

strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes &amp; &quot;;subtree&quot;
adoCommand.CommandText = strQuery
adoCommand.Properties(&quot;Page Size&quot;) = 100
adoCommand.Properties(&quot;Timeout&quot;) = 30
adoCommand.Properties(&quot;Cache Results&quot;) = False

Set adoRecordset = adoCommand.Execute

Do Until adoRecordset.EOF
	If Instr(strHomeMDB,adoRecordset.Fields(&quot;name&quot;).Value) &gt; 1 Then
		Set objWMIExchange = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!//&quot;&amp;_
		adoRecordset.Fields(&quot;name&quot;).Value &amp; &quot;/root/MicrosoftExchangeV2&quot;)
		Set colExchangeMailboxes = objWMIExchange.ExecQuery(&quot;Select * From Exchange_Mailbox Where MailboxDisplayName = '&quot; &amp; strDisplayName &amp; &quot;'&quot;)
		For Each objExchangeMailbox in colExchangeMailboxes
			If Left(objExchangeMailbox.StorageGroupName, 5) &lt;&gt; &quot;Recov&quot; Then
				Wscript.Echo adoRecordset.Fields(&quot;name&quot;).Value &amp; &quot; ; &quot; &amp; objExchangeMailbox.MailboxDisplayName &amp; &quot; ; &quot; &amp;_
				Round(objExchangeMailbox.Size/1024,0) &amp; &quot; MB&quot;
			End If
		Next
		Set colExchange_Mailboxes = Nothing
		Set objWMIExchange = Nothing
	End If
	adoRecordset.MoveNext
Loop

adoRecordset.Close
adoConnection.Close

Set adoRecordset = Nothing
Set objRootDSE = Nothing
Set adoConnection = Nothing
Set adoCommand = Nothing

Function GetDisplayNameAndHomeMDB(strMail)
	Set adoCommand = CreateObject(&quot;ADODB.Command&quot;)
	Set adoConnection = CreateObject(&quot;ADODB.Connection&quot;)
	adoConnection.Provider = &quot;ADsDSOObject&quot;
	adoConnection.Open &quot;Active Directory Provider&quot;
	adoCommand.ActiveConnection = adoConnection

	Set objRootDSE = GetObject(&quot;LDAP://RootDSE&quot;)
	strDNSDomain = objRootDSE.Get(&quot;defaultNamingContext&quot;)
	strBase = &quot;&lt;LDAP://&quot; &amp; strDNSDomain &amp; &quot;&gt;&quot;
	strFilter = &quot;(&amp;(objectCategory=person)(objectClass=user)(mail=&quot; &amp;  strMail &amp; &quot;))&quot;
	strAttributes = &quot;displayName,homeMDB&quot;

	strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes &amp; &quot;;subtree&quot;
	adoCommand.CommandText = strQuery
	adoCommand.Properties(&quot;Page Size&quot;) = 100
	adoCommand.Properties(&quot;Timeout&quot;) = 30
	adoCommand.Properties(&quot;Cache Results&quot;) = False

	Set adoRecordset = adoCommand.Execute
	strDisplayName = adoRecordset.Fields(&quot;displayName&quot;).Value
	strHomeMDB = adoRecordset.Fields(&quot;homeMDB&quot;).Value
	adoRecordset.Close
	adoConnection.Close

	Set adoRecordset = Nothing
	Set objRootDSE = Nothing
	Set adoConnection = Nothing
	Set adoCommand = Nothing
End Function
</pre>
<p>When you have problems/questions please post a reply or give a &#8216;star&#8217; rating.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<p>[adrotate group="2"] </p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Factive-directory-and-wmi-vbscript-to-show-the-size-of-a-specific-mailbox%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/active-directory-and-wmi-vbscript-to-show-the-size-of-a-specific-mailbox/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/active-directory-and-wmi-vbscript-to-show-the-size-of-a-specific-mailbox/"  data-text="Active Directory and WMI: VBscript to show the size of a specific mailbox" data-count="horizontal" data-via="dirkadamsky">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/active-directory-and-wmi-vbscript-to-show-the-size-of-a-specific-mailbox/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory-and-wmi-vbscript-to-show-the-size-of-a-specific-mailbox/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Active Directory: Vbscript to enumerate the lastlogon of all users of a nested group</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-lastlogon-of-all-users-of-a-nested-group/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-lastlogon-of-all-users-of-a-nested-group/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 12:14:01 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[citrix]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[nested group]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[smtp address]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=558</guid>
		<description><![CDATA[Ok let&#8217;s do another nested group script. This script enumerates the lastlogon of all members of a nested group. Attention: the lastlogontimestamp attribute has a treshold of 2 weeks, so recently added users might not occur in the output of the script. Follow the next steps to run the script (no admin rights needed): copy [...]]]></description>
			<content:encoded><![CDATA[<p>Ok let&#8217;s do another nested group script.<br />
This script enumerates the lastlogon of all members of a nested group.<br />
Attention: the lastlogontimestamp attribute has a treshold of 2 weeks, so recently added users might not occur in the output of the script.</p>
<p>Follow the next steps to run the script  (no admin rights needed):</p>
<ul>
<li>copy and paste the script in your favorite text editor</li>
<li>change the distinguished name of the nested group to your group distinguished name</li>
<li>save the script (for example c:tempenumeratenestedgrouplastlogon.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript enumeratenestedgrouplastlogon.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : enumeratenestedgrouplastlogon.vbs
' Description : script to enumerate the lastlogon of all users of a nested group
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 13-04-2010
' Level: intermediate

intBias = TimeZoneBias
strTargetGroupDN = &quot;LDAP://CN=testgroup,OU=Groups,DC=test,DC=org&quot;
EnumNestedgroup strTargetGroupDN
Sub EnumNestedgroup(strGroupDN)
	Set objGroup = GetObject(strGroupDN)
	For Each objMember in objGroup.Members
		If (LCase(objMember.Class) = &quot;group&quot;) Then
			EnumNestedgroup objMember.AdsPath
		ElseIf TypeName(objMember.lastLogonTimeStamp) &lt;&gt; &quot;Empty&quot; Then
			Set objDate = objMember.lastLogonTimeStamp
			If (Err.Number &lt;&gt; 0) Then
				dtmDate = #1/1/1601#
			Else
				dtmDate = ((((objDate.Highpart * (2^32)) + objDate.LowPart)/(600000000 - intBias))/1440) + #1/1/1601#
			End If
			Set objDate = Nothing
			Wscript.Echo objMember.DisplayName &amp; &quot; ; &quot; &amp; objMember.Mail &amp; &quot; ; &quot; &amp; dtmDate
		End If
	Next
	Set objGroup = Nothing
End Sub

Function TimeZoneBias
	strComputer = &quot;.&quot;
	Set objWMIService = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\&quot; &amp; strComputer &amp; &quot;rootcimv2&quot;)
	Set colTimeZone = objWMIService.ExecQuery(&quot;Select * from Win32_TimeZone&quot;)
	For Each objTimeZone in colTimeZone
		TimeZoneBias = objTimeZone.Bias
	Next
	Set colTimeZone = Nothing
	Set objWMIService = Nothing
End Function
</pre>
<p>When you have problems/questions please post a reply or give a &#8216;star&#8217; rating.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Factive-directory%2Fcitrix%2Factive-directory-vbscript-to-enumerate-the-lastlogon-of-all-users-of-a-nested-group%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-lastlogon-of-all-users-of-a-nested-group/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-lastlogon-of-all-users-of-a-nested-group/"  data-text="Active Directory: Vbscript to enumerate the lastlogon of all users of a nested group" data-count="horizontal" data-via="dirkadamsky">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-lastlogon-of-all-users-of-a-nested-group/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-lastlogon-of-all-users-of-a-nested-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active Directory: Vbscript to enumerate all users of a nested group with a citrix token</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-citrix-tokens-of-a-nested-group/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-citrix-tokens-of-a-nested-group/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 10:52:03 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[citrix]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[groups]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[nested group]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[smtp address]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=547</guid>
		<description><![CDATA[Script for today is a mutation of my previous enumerate nested group script. The script enumerates all nested group users with a citrix token. Follow the next steps to run the script (no admin rights needed): copy and paste the script in your favorite text editor change the distinguished name of the nested group to [...]]]></description>
			<content:encoded><![CDATA[<p>Script for today is a mutation of my previous <a href="http://deludi.nl/blog/vbscript/active-directory/groups/active-directory-vbscript-to-enumerate-the-members-of-nested-groups-v2/">enumerate nested group script</a>.<br />
The script enumerates all nested group users with a citrix token.</p>
<p>Follow the next steps to run the script  (no admin rights needed):</p>
<ul>
<li>copy and paste the script in your favorite text editor</li>
<li>change the distinguished name of the nested group to your group distinguished name</li>
<li>save the script (for example c:tempenumeratenestedgrouptokens.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript enumeratenestedgrouptokens.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : enumeratenestedgrouptokens.vbs
' Description : script to enumerate the citrix tokens of a nested group
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 13-04-2010
' Level: intermediate
strTargetGroupDN = &quot;LDAP://CN=testgroup,OU=groups,DC=test,DC=org&quot;
EnumNestedgroup strTargetGroupDN
Sub EnumNestedgroup(strGroupDN)
	Set objGroup = GetObject(strGroupDN)
	For Each objMember in objGroup.Members
		If (LCase(objMember.Class) = &quot;group&quot;) Then
			EnumNestedgroup objMember.AdsPath
		ElseIf objMember.[securecomputingCom2000-SafeWord-UserID] &lt;&gt; &quot;&quot; Then
			Wscript.Echo objMember.DisplayName &amp; &quot; ; &quot; &amp; objMember.Mail &amp; &quot; ; &quot; &amp; objMember.[securecomputingCom2000-SafeWord-UserID]
		End If
	Next
	Set objGroup = Nothing
End Sub
</pre>
<p>When you have problems/questions please post a reply or give a &#8216;star&#8217; rating.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Factive-directory%2Fcitrix%2Factive-directory-vbscript-to-enumerate-the-citrix-tokens-of-a-nested-group%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-citrix-tokens-of-a-nested-group/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-citrix-tokens-of-a-nested-group/"  data-text="Active Directory: Vbscript to enumerate all users of a nested group with a citrix token" data-count="horizontal" data-via="dirkadamsky">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-citrix-tokens-of-a-nested-group/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/citrix/active-directory-vbscript-to-enumerate-the-citrix-tokens-of-a-nested-group/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Active Directory and WMI: VBscript to enumerate all mailboxes and their size in your AD domain</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/active-directory-and-wmi-vbscript-to-enumerate-all-mailboxes-and-their-size-of-your-ad-domain/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/active-directory-and-wmi-vbscript-to-enumerate-all-mailboxes-and-their-size-of-your-ad-domain/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 09:59:37 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[exchange]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[mailbox size]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=523</guid>
		<description><![CDATA[Today&#8217;s script is an extension of yesterday&#8217;s script. What the script does: get all exchange servers from your AD domain make a wmi connection to each server and create a list of the mailboxes and their size The script is tested in an win2003/exchange2003 environment. Follow the next steps to run the script (admin rights [...]]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s script is an extension of <a href="http://deludi.nl/blog/vbscript/active-directory/exchange-active-directory-vbscript/active-directory-vbscript-to-enumerate-all-exchange-servers-in-your-ad-domain/">yesterday&#8217;s script</a>.<br />
What the script does:</p>
<ul>
<li>get all exchange servers from your AD domain</li>
<li>make a wmi connection to each server and create a list of the mailboxes and their size</li>
</ul>
<p>The script is tested in an win2003/exchange2003 environment.</p>
<p>Follow the next steps to run the script  (admin rights needed):</p>
<ul>
<li>copy and paste the script in your favorite text editor</li>
<li>save the script (for example c:templistallmailboxes.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript listallmailboxes.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : listallmailboxes.vbs
' Description : script to enumerate all mailboxes and their size in your AD domain
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 07-04-2010
' Level: intermediate

Set adoCommand = CreateObject(&quot;ADODB.Command&quot;)
Set adoConnection = CreateObject(&quot;ADODB.Connection&quot;)
adoConnection.Provider = &quot;ADsDSOObject&quot;
adoConnection.Open &quot;Active Directory Provider&quot;
adoCommand.ActiveConnection = adoConnection

Set objRootDSE = GetObject(&quot;LDAP://RootDSE&quot;)
strBase = &quot;&lt;LDAP://&quot; &amp; objRootDSE.Get(&quot;configurationnamingcontext&quot;) &amp; &quot;&gt;&quot;
strFilter = &quot;(objectCategory=msExchExchangeServer)&quot;
strAttributes = &quot;name&quot;

strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes &amp; &quot;;subtree&quot;
adoCommand.CommandText = strQuery
adoCommand.Properties(&quot;Page Size&quot;) = 100
adoCommand.Properties(&quot;Timeout&quot;) = 30
adoCommand.Properties(&quot;Cache Results&quot;) = False

Set adoRecordset = adoCommand.Execute

Do Until adoRecordset.EOF
	Set objWMIExchange = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!//&quot;&amp;_
	adoRecordset.Fields(&quot;name&quot;).Value &amp; &quot;/root/MicrosoftExchangeV2&quot;)
    Set colExchangeMailboxes = objWMIExchange.InstancesOf(&quot;Exchange_Mailbox&quot;)
    For Each objExchangeMailbox in colExchangeMailboxes
        If Left(objExchangeMailbox.StorageGroupName, 5) &lt;&gt; &quot;Recov&quot; Then
			Wscript.Echo adoRecordset.Fields(&quot;name&quot;).Value &amp; &quot; ; &quot; &amp; objExchangeMailbox.MailboxDisplayName &amp; &quot; ; &quot; &amp;_
			Round(objExchangeMailbox.Size/1024,0) &amp; &quot; MB&quot;
		End If
	Next
	Set colExchange_Mailboxes = Nothing
	Set objWMIExchange = Nothing
	adoRecordset.MoveNext
Loop

adoRecordset.Close
adoConnection.Close

Set adoRecordset = Nothing
Set objRootDSE = Nothing
Set adoConnection = Nothing
Set adoCommand = Nothing
</pre>
<p>When you have problems/questions please post a reply or give a &#8216;star&#8217; rating.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Factive-directory%2Fexchange-active-directory-vbscript%2Factive-directory-and-wmi-vbscript-to-enumerate-all-mailboxes-and-their-size-of-your-ad-domain%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/active-directory-and-wmi-vbscript-to-enumerate-all-mailboxes-and-their-size-of-your-ad-domain/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/active-directory-and-wmi-vbscript-to-enumerate-all-mailboxes-and-their-size-of-your-ad-domain/"  data-text="Active Directory and WMI: VBscript to enumerate all mailboxes and their size in your AD domain" data-count="horizontal" data-via="dirkadamsky">Tweet</a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/active-directory-and-wmi-vbscript-to-enumerate-all-mailboxes-and-their-size-of-your-ad-domain/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/exchange-active-directory-vbscript/active-directory-and-wmi-vbscript-to-enumerate-all-mailboxes-and-their-size-of-your-ad-domain/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
	</channel>
</rss>

