<?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; filesystem object</title>
	<atom:link href="http://vbscriptblog.com/tag/filesystem-object/feed/" rel="self" type="application/rss+xml" />
	<link>http://vbscriptblog.com</link>
	<description>Scripting for Windows Sysadmins</description>
	<lastBuildDate>Wed, 11 Apr 2012 07:23:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Active Directory: Vbscript to enumerate all Active Directory users sorted by OU</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/ou/active-directory-vbscript-to-enumerate-all-active-directory-users-sorted-by-ou/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/ou/active-directory-vbscript-to-enumerate-all-active-directory-users-sorted-by-ou/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 10:53:24 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[ou]]></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[filesystem object]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://vbscriptblog.com/?p=1288</guid>
		<description><![CDATA[Austin Murtha sent me an email with a script question. His problem was a script that enumerates users and their OU&#8217;s. I have created the script below to help him. What the script does: create a &#8220;disconnected recordset&#8221; (for the sorting stuff) get all users from active directory with an ADO query remove undesired results [...]]]></description>
			<content:encoded><![CDATA[<p>Austin Murtha sent me an email with a script question.<br />
His problem was a script that enumerates users and their OU&#8217;s.<br />
I have created the script below to help him.</p>
<p>What the script does:</p>
<ol>
<li>create a &#8220;disconnected recordset&#8221; (for the sorting stuff)</li>
<li>get all users from active directory with an ADO query</li>
<li>remove undesired results (if instr&#8230;)</li>
<li>add the rest to the disconnected recordset</li>
<li>sort the recordset</li>
<li>output to the screen</li>
</ol>
<p>Follow the next steps to run the script (no admin rights needed):</p>
<ul>
<li>copy and paste the script below into the editor (you can use the icons in the upper rights corner of the code)</li>
<li>save the script (for example c:\temp\usersinou.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:\temp&#8221;</li>
<li>give &#8220;cscript usersinou.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : usersinou.vbs
' Description : script to enumerate all Active Directory users sorted by OU
' Author : dirk adamsky - deludi bv
' Version : 1.0
' Date : 05-10-2011

Set DataList = CreateObject(&quot;ADOR.Recordset&quot;)
DataList.Fields.Append &quot;Name&quot;, 200, 255
DataList.Fields.Append &quot;OU&quot;, 200, 255
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;&quot;
strFilter = &quot;(&amp;(objectCategory=person)(objectClass=user))&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
	If Instr(adoRecordset.Fields(&quot;distinguishedname&quot;).Value,&quot;OU=&quot;) &gt; 1 Then
		DataList.AddNew
		DataList(&quot;Name&quot;) = adoRecordset.Fields(&quot;name&quot;).Value
		DataList(&quot;OU&quot;) = Mid(adoRecordset.Fields(&quot;distinguishedname&quot;).Value, Instr(adoRecordset.Fields(&quot;distinguishedname&quot;).Value,&quot;OU=&quot;))
		Datalist.Update
	End If
	adoRecordset.MoveNext
Loop

adoRecordset.Close
adoConnection.Close

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

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

Do Until DataList.EOF
     Wscript.Echo DataList.Fields.Item(&quot;OU&quot;) &amp; &quot; ; &quot; &amp; DataList.Fields.Item(&quot;Name&quot;)
     DataList.MoveNext
Loop

Datalist.Close
Set DataList = Nothing
</pre>
<p>When you have a modified version or problems/questions that you want to share please post it at the comments below.</p>
<p>Happy scripting.</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%2Fou%2Factive-directory-vbscript-to-enumerate-all-active-directory-users-sorted-by-ou%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" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></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/ou/active-directory-vbscript-to-enumerate-all-active-directory-users-sorted-by-ou/"></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/ou/active-directory-vbscript-to-enumerate-all-active-directory-users-sorted-by-ou/"  data-text="Active Directory: Vbscript to enumerate all Active Directory users sorted by OU" data-count="horizontal" data-via="dirkadamsky"></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/ou/active-directory-vbscript-to-enumerate-all-active-directory-users-sorted-by-ou/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/ou/active-directory-vbscript-to-enumerate-all-active-directory-users-sorted-by-ou/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active Directory: VBscript to enumerate the home directories and their sizes of all users in Active Directory</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/home-directories/active-directory-vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/home-directories/active-directory-vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 13:47:04 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[home directories]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[filesystem object]]></category>
		<category><![CDATA[home directory]]></category>
		<category><![CDATA[list]]></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://vbscriptblog.com/?p=1245</guid>
		<description><![CDATA[Update: This script has some issues (path not found) with users with very large home folders and or homefolders with long pathnames. This is due to limitations of the Filesystem Object. I will see if i can make a &#8220;better solution&#8221;. Dave asked me for a script to enumerate all AD users, their home directories [...]]]></description>
			<content:encoded><![CDATA[<p>Update: This script has some issues (path not found) with users with very large home folders and or homefolders with long pathnames. This is due to limitations of the Filesystem Object. I will see if i can make a &#8220;better solution&#8221;.</p>
<p>Dave asked me for a script to enumerate all AD users, their home directories and the size of them.<br />
I already had the script to do that for <a href="http://vbscriptblog.com/vbscript/active-directory/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/">roaming profiles</a>.<br />
This script is a modified version.</p>
<p>Follow the next steps to run the script (admin rights needed for access to the home directories):</p>
<p>* open your favorite text editor<br />
* copy and paste the script into the editor<br />
* save the script (for example c:\temp\homedirectorysize.vbs)<br />
* open a command prompt<br />
* go to &#8220;c:\temp&#8221;<br />
* give &#8220;cscript homedirectorysize.vbs&#8221; (without quotes) and enter</p>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : homedirectorysize.vbs
' Description : script to enumerate the home directories and their sizes of all users in Active Directory
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 12-07-2011
' Level : intermediate

arrAttributes = Array(&quot;homeDirectory&quot;,&quot;displayname&quot;,&quot;mail&quot;) 

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;
Set objRootDSE = Nothing

strFilter = &quot;(&amp;(objectCategory=person)(objectClass=user)(homeDirectory=*))&quot;
strAttributes = Join(arrAttributes,&quot;,&quot;)
Wscript.Echo Join(arrAttributes,&quot;;&quot;) &amp; &quot; ; home directory size in MB&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
	On Error Resume Next
	strTempOutput = &quot;&quot;
	For i = 0 To Ubound(arrAttributes)
		strTempOutput =  strTempOutput &amp; &quot; ; &quot; &amp; adoRecordset.Fields(arrAttributes(i)).Value
		strOutput = Mid(Ltrim(strTempOutput),3)
	Next
	Wscript.Echo strOutput &amp; &quot; ; &quot; &amp; Foldersize (adoRecordset.Fields(arrAttributes(0)).Value) &amp; &quot; MB&quot;
	adoRecordset.MoveNext
Loop
adoRecordset.Close
adoConnection.Close
Set adoRecordset = Nothing
Set adoConnection = Nothing
Set adoCommand = Nothing

Function Foldersize(strPath)
	On Error Resume Next
	Set objFSO = CreateObject(&quot;scripting.filesystemobject&quot;)
	Set objFld = objFSO.GetFolder(strPath)
	Foldersize = Round(objFld.Size/1048576,2)
	Set objFld = Nothing
	Set objFSO = Nothing
End Function
</pre>
<p>When you have problems/questions please post a reply. Also can alo 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%2Fhome-directories%2Factive-directory-vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory%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" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></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/home-directories/active-directory-vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory/"></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/home-directories/active-directory-vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory/"  data-text="Active Directory: VBscript to enumerate the home directories and their sizes of all users in Active Directory" data-count="horizontal" data-via="dirkadamsky"></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/home-directories/active-directory-vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/home-directories/active-directory-vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Active Directory: VBscript to enumerate the local profile size of all computers and users in Active Directory</title>
		<link>http://vbscriptblog.com/vbscript/localprofiles/active-directory-vbscript-to-enumerate-the-local-profile-size-of-all-computers-and-users-in-active-directory/</link>
		<comments>http://vbscriptblog.com/vbscript/localprofiles/active-directory-vbscript-to-enumerate-the-local-profile-size-of-all-computers-and-users-in-active-directory/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 13:43:49 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[localprofiles]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[filesystem object]]></category>
		<category><![CDATA[folder]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[status]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://vbscriptblog.com/?p=1220</guid>
		<description><![CDATA[This script is made for Mike. He asked for a script to enumerate all local profiles and their size of the computers in his network. Complicating factor is the use of both Windows XP and Windows 7 clients. As you probably know that they have different local profile paths: Windows XP &#8211; &#8220;c:\documents and settings&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>This script is made for <a href="http://vbscriptblog.com/vbscript/active-directory/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/">Mike</a>.<br />
He asked for a script to enumerate all local profiles and their size of the computers in his network.<br />
Complicating factor is the use of both Windows XP and Windows 7 clients.<br />
As you probably know that they have different local profile paths:</p>
<p>Windows XP &#8211; &#8220;c:\documents and settings&#8221;</p>
<p>Windows 7 &#8211; &#8220;c:\users&#8221;</p>
<p>The script has to do:</p>
<ul>
<li>get all Windows XP and Windows 7 clients from Active Directory</li>
<li>check if they are online</li>
<li>get the local profiles and their sizes from each machine</li>
<li>write the values to a central logfile</li>
</ul>
<p>Follow the next steps to run the script (local admin rights needed for access to the target pc&#8217;s):</p>
<p>* open your favorite text editor<br />
* copy and paste the script into the editor<br />
* change the logfile location in line 73 (now c:\temp)<br />
* save the script (for example c:\temp\localprofiles.vbs)<br />
* open a command prompt<br />
* go to &#8220;c:\temp&#8221;<br />
* give &#8220;cscript localprofiles.vbs&#8221; (without quotes) and enter</p>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : localprofiles.vbs
' Description : script to enumerate the local profile size of all computers and users in Active Directory
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 28-06-2011

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=computer)(|(operatingSystem=Windows XP Professional)(operatingSystem=Windows 7*)))&quot;
strAttributes = &quot;name, operatingSystem&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;operatingSystem&quot;).Value, &quot;XP&quot;) &gt; 0 Then
			strLocalProfilePath = &quot;\Documents and Settings\&quot;
		ElseIf Instr(adoRecordset.Fields(&quot;operatingSystem&quot;).Value, &quot;7&quot;) &gt; 0 Then
			strLocalProfilePath = &quot;\users\&quot;
		End If
		GetLocalProfileSize strHostname, &quot;\\&quot; &amp; strHostname &amp; &quot;\c$&quot; &amp; strLocalProfilePath
	End If
	adoRecordset.MoveNext
Loop

adoRecordset.Close
adoConnection.Close

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 GetLocalProfileSize(strTargetMachine, strFolder)
	Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	Set objFolder = objFSO.GetFolder(strFolder)
	For Each SubFolder in objFolder.SubFolders
		Logprint strTargetMachine &amp; &quot; ; &quot; &amp; SubFolder.Name &amp; &quot; ; &quot; &amp; SubFolder.Path &amp; &quot; ; &quot; &amp; Round(SubFolder.Size/1048576,2) &amp; &quot; MB&quot;
	Next
	Set objFolder = Nothing
	Set objFSO = Nothing
End Function

Function LogPrint(Message)
Const ForAppending = 8
strDate = Replace(Date,&quot;/&quot;,&quot;-&quot;)
Set ObjFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set objTextFile = ObjFSO.OpenTextFile(&quot;c:\temp\&quot; &amp; strDate &amp; &quot;-localprofiles.csv&quot;, ForAppending, True)
    objTextFile.WriteLine Message
    objTextFile.Close
Set objTextFile = Nothing
Set ObjFSO = Nothing
End Function
</pre>
<p>When you have problems/questions please post a reply. Also can also 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%2Flocalprofiles%2Factive-directory-vbscript-to-enumerate-the-local-profile-size-of-all-computers-and-users-in-active-directory%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" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></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/localprofiles/active-directory-vbscript-to-enumerate-the-local-profile-size-of-all-computers-and-users-in-active-directory/"></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/localprofiles/active-directory-vbscript-to-enumerate-the-local-profile-size-of-all-computers-and-users-in-active-directory/"  data-text="Active Directory: VBscript to enumerate the local profile size of all computers and users in Active Directory" data-count="horizontal" data-via="dirkadamsky"></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/localprofiles/active-directory-vbscript-to-enumerate-the-local-profile-size-of-all-computers-and-users-in-active-directory/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/localprofiles/active-directory-vbscript-to-enumerate-the-local-profile-size-of-all-computers-and-users-in-active-directory/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Various: Delete a vb script after running (this script will self destruct in xx seconds)</title>
		<link>http://vbscriptblog.com/various/various-delete-a-vb-script-after-running-this-script-will-self-destruct-in-xx-seconds/</link>
		<comments>http://vbscriptblog.com/various/various-delete-a-vb-script-after-running-this-script-will-self-destruct-in-xx-seconds/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 11:07:52 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[Various]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[filesystem object]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=695</guid>
		<description><![CDATA[Yesterday I did some work on VMware VDI. I had a problem with the clones joining the 2003 domain. The joining fails for 5% of the new cloned Win XP machines. VMware VDI uses sysprep to rename, join domain, etc. The sysprep inf file is generated by a customization specification. Also in the customization specification [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I did some work on VMware VDI.</p>
<p>I had a problem with the clones joining the 2003 domain.<br />
The joining fails for 5% of the new cloned Win XP machines.<br />
VMware VDI uses <a href="http://support.microsoft.com/kb/302577">sysprep</a> to rename, join domain, etc.<br />
The <a href="http://support.microsoft.com/kb/302577">sysprep</a> inf file is generated by a <a href="http://pubs.vmware.com/vi301/admin/wwhelp/wwhimpl/common/html/wwhelp.htm?context=admin&amp;file=BSA_Customizing.15.4.html">customization specification</a>.<br />
Also in the customization specification I had a small afterjob that<br />
moves the computer account to the right AD container (I used the <a href="http://technet.microsoft.com/en-us/library/cc732406%28WS.10%29.aspx">Dsmod utility</a>),<br />
this afterjob also failed in 5% of the cases.</p>
<p>I decided to do some scripting.<br />
The script to join the domain I already had, I only had to add 2 parts:</p>
<ol>
<li>Something to remove the script after running (because it contains admin credentials)</li>
<li>Something to reboot the machine after running the job</li>
</ol>
<p>For the destruction of the script after running I found this code:</p>
<pre class="brush: vb; title: ; notranslate">
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
objFSO.DeleteFile(Wscript.ScriptFullName)
Set objFSO = Nothing
</pre>
<p>Cut and paste this code at the end of your script.<br />
Normally the script code is parsed before running so there should be no <a href="http://en.wikipedia.org/wiki/File_locking">File Locking</a> problem removing the script.</p>
<p>Tomorrow I will post the completed script with:</p>
<ul>
<li>Join domain</li>
<li>Add the right container</li>
<li>Remove the script file</li>
<li>Reboot the machine</li>
</ul>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<p>[adrotate group="3"] </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%2Fvarious-delete-a-vb-script-after-running-this-script-will-self-destruct-in-xx-seconds%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" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></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/various-delete-a-vb-script-after-running-this-script-will-self-destruct-in-xx-seconds/"></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/various-delete-a-vb-script-after-running-this-script-will-self-destruct-in-xx-seconds/"  data-text="Various: Delete a vb script after running (this script will self destruct in xx seconds)" data-count="horizontal" data-via="dirkadamsky"></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/various-delete-a-vb-script-after-running-this-script-will-self-destruct-in-xx-seconds/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/various/various-delete-a-vb-script-after-running-this-script-will-self-destruct-in-xx-seconds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Active Directory: VBscript to enumerate the roaming profile size of all users in Active Directory</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 10:14:19 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[roamingprofile]]></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[files]]></category>
		<category><![CDATA[filesystem object]]></category>
		<category><![CDATA[folder]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[profilePath]]></category>
		<category><![CDATA[roaming profile]]></category>
		<category><![CDATA[smtp address]]></category>
		<category><![CDATA[status]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=427</guid>
		<description><![CDATA[For a sysadmin roaming profiles are both a blessing and a curse. In time they tend to grow and grow&#8230; The roaming profile size problem results in: long logon and logoff times, corrupted profiles, etc. This script enumerates the roaming profile size of all users in your Active Directory domain. By adding extra attributes to [...]]]></description>
			<content:encoded><![CDATA[<p>For a sysadmin roaming profiles are both a blessing and a curse.<br />
In time they tend to grow and grow&#8230;<br />
The roaming profile size problem results in: long logon and logoff times, corrupted profiles, etc.<br />
This script enumerates the roaming profile size of all users in your Active Directory domain.<br />
By adding extra attributes to the arrAttributes array you can change the output. </p>
<p>Follow the next steps to run the script (admin rights needed for access to the roaming profiles directory):</p>
<p>* open your favorite text editor<br />
* copy and paste the script into the editor<br />
* save the script (for example c:\temp\roamingprofilesize.vbs)<br />
* open a command prompt<br />
* go to &#8220;c:\temp&#8221;<br />
* give &#8220;cscript roamingprofilesize.vbs&#8221; (without quotes) and enter</p>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : roamingprofilesize.vbs
' Description : script to enumerate the roaming profile size of all users in Active Directory
' Author : dirk adamsky - deludi bv
' Version : 1.10 (changed script error based on input from Jim)
' Date : 06-05-2011
' Level : intermediate

arrAttributes = Array(&quot;profilePath&quot;,&quot;displayname&quot;,&quot;mail&quot;) 

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;
Set objRootDSE = Nothing

strFilter = &quot;(&amp;(objectCategory=person)(objectClass=user)(profilePath=*))&quot;
strAttributes = Join(arrAttributes,&quot;,&quot;)
Wscript.Echo Join(arrAttributes,&quot;;&quot;) &amp; &quot; ; roaming profile size in MB&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
	On Error Resume Next
	strTempOutput = &quot;&quot;
	For i = 0 To Ubound(arrAttributes)
		strTempOutput =  strTempOutput &amp; &quot; ; &quot; &amp; adoRecordset.Fields(arrAttributes(i)).Value
		strOutput = Mid(Ltrim(strTempOutput),3)
	Next
	Wscript.Echo strOutput &amp; &quot; ; &quot; &amp; Foldersize (adoRecordset.Fields(arrAttributes(0)).Value) &amp; &quot; MB&quot;
	adoRecordset.MoveNext
Loop
adoRecordset.Close
adoConnection.Close
Set adoRecordset = Nothing
Set adoConnection = Nothing
Set adoCommand = Nothing

Function Foldersize(strPath)
	On Error Resume Next
	Set objFSO = CreateObject(&quot;scripting.filesystemobject&quot;)
	Set objFld = objFSO.GetFolder(strPath)
	Foldersize = Round(objFld.Size/1048576,2)
	Set objFld = Nothing
	Set objFSO = Nothing
End Function
</pre>
<p>When you have problems/questions please post a reply. Also can alo 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%2Froamingprofile%2Factive-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory%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" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></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/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/"></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/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/"  data-text="Active Directory: VBscript to enumerate the roaming profile size of all users in Active Directory" data-count="horizontal" data-via="dirkadamsky"></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/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Filesystem: VBscript to enumerate the subfolders (recursive) with depth limit</title>
		<link>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/</link>
		<comments>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 10:28:59 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[folders]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[depth]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[filesystem object]]></category>
		<category><![CDATA[limit]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[objFSO]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[subfolders]]></category>
		<category><![CDATA[unc]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=404</guid>
		<description><![CDATA[Here&#8217;s the second script of today. It is a mutation of the previous script. Added is a depth limit, this is done by a second argument of the subroutine. The subroutine needs two arguments: the path of the folder and the depth level. The path can be local (&#8220;c:temp&#8221;) or an UNC path like &#8220;\servertest&#8221;. [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the second script of today.<br />
It is a mutation of the previous <a href="http://deludi.nl/blog/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/">script</a>.<br />
Added is a depth limit, this is done by a second argument of the subroutine.<br />
The subroutine needs two arguments: the path of the folder and the depth level.<br />
The path can be local (&#8220;c:temp&#8221;) or an UNC path like &#8220;\servertest&#8221;.</p>
<p>Follow the next steps to run the script  (admin rights needed on the folder you want to enumerate):</p>
<ul>
<li>open your favorite text editor</li>
<li>copy and paste the script into the editor</li>
<li>change the path of the folder to your folder path</li>
<li>change the depth value to your depth value (current value = 2)</li>
<li>save the script (for example c:tempenumeratesubfolderslevel.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript enumeratesubfolderslevel.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : enumeratesubfolderslevel.vbs
' Description : script to enumerate the subfolders (recursive) with depth limit
' Author : dirk adamsky - deludi bv
' Version : 1.01 corrected small counter error
' Date : 05-03-2010
' Level : Intermediate

ViewSubFolders &quot;c:temp&quot;, 2
Sub ViewSubFolders(strFolder, strMaxLevel)
	Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	Set objFolder = objFSO.GetFolder(strFolder)
	If strMaxlevel &gt;= 1 Then
		For Each SubFolder in objFolder.SubFolders
			Wscript.Echo SubFolder.Path
			ViewSubFolders SubFolder, (strMaxlevel - 1)
		Next
	End If
	Set objFolder = Nothing
	Set objFSO = Nothing
End Sub
</pre>
<p>When you have problems/questions please make a reply, when you like the script please rate it with the star rating below.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<p>[adrotate group="2" banner="3"] </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%2Ffilesystem%2Ffolders%2Ffilesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit%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" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></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/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/"></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/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/"  data-text="Filesystem: VBscript to enumerate the subfolders (recursive) with depth limit" data-count="horizontal" data-via="dirkadamsky"></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/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filesystem: VBscript to enumerate all subfolders (recursive) of a given folder</title>
		<link>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/</link>
		<comments>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 08:10:57 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[folders]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[filesystem object]]></category>
		<category><![CDATA[folder]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[subfolders]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=395</guid>
		<description><![CDATA[The motto of the day is: Recursion rules. A couple of years ago I have done quite a few Filesystem Object scripts. To refresh my mind I have made some new filesystem scripts. This is the first one: a simple subroutine that uses recursion to enumrate all subfolders of a folder. The subroutine needs one [...]]]></description>
			<content:encoded><![CDATA[<p>The motto of the day is: Recursion rules.<br />
A couple of years ago I have done quite a few Filesystem Object scripts.<br />
To refresh my mind I have made some new filesystem scripts.<br />
This is the first one: a simple subroutine that uses recursion to enumrate all subfolders of a folder.<br />
The subroutine needs one argument: the path of the folder.<br />
The path can be local (&#8220;c:temp&#8221;) or an UNC path like &#8220;\servertest&#8221;.</p>
<p>Follow the next steps to run the script  (admin rights needed on the folder you want to enumerate):</p>
<ul>
<li>open your favorite text editor</li>
<li>copy and paste the script into the editor</li>
<li>change the path of the folder to your folder path</li>
<li>save the script (for example c:tempenumeratesubfolders.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript enumeratesubfolders.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : enumeratesubfolders.vbs
' Description : script to enumerate all subfolders (recursive) of a given folder
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 05-03-2010
' Level : Intermediate

ViewSubFolders &quot;c:temp&quot;
Sub ViewSubFolders(strFolder)
	Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	Set objFolder = objFSO.GetFolder(strFolder)
	For Each SubFolder in objFolder.SubFolders
		Wscript.Echo SubFolder.Path
		ViewSubFolders SubFolder
	Next
	Set objFolder = Nothing
	Set objFSO = Nothing
End Sub
</pre>
<p>When you have problems/questions please make a reply, when you like the script please rate it with the star rating below.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<p>[adrotate group="3"] </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%2Ffilesystem%2Ffolders%2Ffilesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder%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" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></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/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/"></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/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/"  data-text="Filesystem: VBscript to enumerate all subfolders (recursive) of a given folder" data-count="horizontal" data-via="dirkadamsky"></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/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

