<?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; folder</title>
	<atom:link href="http://vbscriptblog.com/tag/folder/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>VBscript to enumerate the home directories and their sizes of all users in Active Directory V2</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/home-directories/vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory-v2/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/home-directories/vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory-v2/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 14:03:59 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[home directories]]></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[folder]]></category>
		<category><![CDATA[homedirectory]]></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=1257</guid>
		<description><![CDATA[This is a better version of my previous script to enumerate the home directory sizes of all active directory users. The problem with the previous one was that some home directory sizes were not calculated because the Filesystem object had difficulties with long pathnames. I did a search for a WMI based solution but unfortunately [...]]]></description>
			<content:encoded><![CDATA[<p>This is a better version of my <a 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/">previous script to enumerate the home directory sizes of all active directory users</a>. The problem with the previous one was that some home directory sizes were not calculated because the Filesystem object had difficulties with <a href="http://msdn.microsoft.com/en-us/library/ms165768.aspx">long pathnames</a>.<br />
I did a search for a WMI based solution but unfortunately i could not find one.<br />
To shorten the UNC path i decided to create a drive mapping with the Wscript Network object.<br />
It&#8217;s a bit of a &#8220;funky solution&#8221; but it works.</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\homedirectorysizev2.vbs)<br />
* open a command prompt<br />
* go to &#8220;c:\temp&#8221;<br />
* give &#8220;cscript homedirectorysizev2.vbs&#8221; (without quotes) and enter</p>
<p>Notes:<br />
1. when you run the script as administrator a h: network drive is created and disconnected for each user. When you want another drive letter you can change h: in the function to another drive letter.<br />
2. when you cancel the script before it is finished please manually disconnect the &#8220;h:&#8221; drive mapping</p>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : homedirectorysizev2.vbs
' Description : script to enumerate the home directories and their sizes of all users in Active Directory v2
' Author : dirk adamsky - deludi bv
' Version : 2.00
' Date : 14-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 objNetwork = CreateObject(&quot;WScript.Network&quot;)
	Set objFSO = CreateObject(&quot;scripting.filesystemobject&quot;)
	objNetwork.MapNetworkDrive &quot;h:&quot;, strPath
	Set objFld = objFSO.GetFolder(&quot;h:&quot;)
	Foldersize = Round(objFld.Size/1048576,2)
	objNetwork.RemoveNetworkDrive &quot;h:&quot;
	Set objFld = 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%2Factive-directory%2Fhome-directories%2Fvbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory-v2%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/vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory-v2/"></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/vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory-v2/"  data-text="VBscript to enumerate the home directories and their sizes of all users in Active Directory V2" 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/vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory-v2/"></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/vbscript-to-enumerate-the-home-directories-and-their-sizes-of-all-users-in-active-directory-v2/feed/</wfw:commentRss>
		<slash:comments>2</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>Active Directory and WMI: VBscript to enumerate the ntfs rights of a given UNC path and a given level of subfolders</title>
		<link>http://vbscriptblog.com/vbscript/wmi/ntfsrights/active-directory-and-wmi-vbscript-to-enumerate-the-ntfs-rights-of-a-given-unc-path-and-a-given-level-of-subfolders/</link>
		<comments>http://vbscriptblog.com/vbscript/wmi/ntfsrights/active-directory-and-wmi-vbscript-to-enumerate-the-ntfs-rights-of-a-given-unc-path-and-a-given-level-of-subfolders/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 11:39:09 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[ntfsrights]]></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[folder]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[subfolders]]></category>
		<category><![CDATA[user]]></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=779</guid>
		<description><![CDATA[Today I have extended the previous script: it now also enumerates the NTFS rights of subfolders below the share. As a bonus the level of subfolders can be set Follow the next steps to run the script (admin rights needed for the WMI connection): copy and paste the script in your favorite text editor save [...]]]></description>
			<content:encoded><![CDATA[<p>Today I have extended the <a href="http://deludi.nl/blog/vbscript/wmi/ntfsrights/active-directory-and-wmi-vbscript-to-enumerate-the-ntfs-rights-of-a-given-unc-path/">previous script:</a><br />
it now also enumerates the NTFS rights of subfolders below the share.<br />
As a bonus the level of subfolders can be set</p>
<p>Follow the next steps to run the script (admin rights needed for the <a href="http://en.wikipedia.org/wiki/Windows_Management_Instrumentation" target="_blank">WMI</a> connection):</p>
<ul>
<li>copy and paste the script in your favorite text editor</li>
<li>save the script (for example c:\temp\uncacl2.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:\temp&#8221;</li>
<li>give &#8220;cscript uncacl2.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : uncacl2.vbs
' Description : script to enumerate the ntfs rights of a given UNC path and a given level of subfolders
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 22-10-2010

strUNCPathName = InputBox(&quot;please supply the UNC path to the shared folder&quot;)
strSubfolderLevel = InputBox(&quot;please supply the subfolder depth (1,2,etc.)&quot;)
arrUNC = split(strUNCPathName,&quot;\&quot;)
If Ubound(arrUNC) &gt; 3 Then
strRightPartOfPath = Mid(strUNCPathName,(Instr(strUNCPathName,arrUNC(4)) -1))
End If
Set objWMI = GetObject(&quot;winmgmts:\\&quot; &amp; arrUNC(2) &amp; &quot;\root\CIMV2&quot;)
Set objFileShare = objWMI.Get(&quot;Win32_Share.Name=&quot;&quot;&quot; &amp; arrUNC(3) &amp; &quot;&quot;&quot;&quot;)
If Right(arrUNC(3),1) = &quot;$&quot; And Len(arrUNC(3)) = 2 Then
strPath = objFileShare.Path &amp; Mid(strRightPartOfPath,2)
Else
strPath = objFileShare.Path &amp; strRightPartOfPath
End If
ShowACL strPath
ViewSubFolders strPath, strSubfolderLevel
Set objFileShare = Nothing
Set objWMI = Nothing

Function ViewSubfolders(strFolder, strMaxlevel)
Set colSubfolders = objWMI.ExecQuery(&quot;Associators Of {Win32_Directory.Name='&quot; &amp; strFolder &amp; &quot;'} &quot; &amp;_
&quot;Where AssocClass = Win32_Subdirectory ResultRole = PartComponent&quot;)
If strMaxlevel &gt;= 1 Then
    For Each SubFolder in colSubfolders
        wscript.echo SubFolder.Name
        ShowACL SubFolder.Name
        ViewSubFolders SubFolder.Name, (strMaxlevel - 1)
    Next
End If
Set colSubfolders = Nothing
End Function

Function ShowACL(strDir)
Set objFolderSecuritySettings = objWMI.Get(&quot;Win32_LogicalFileSecuritySetting.Path='&quot; &amp; strDir &amp; &quot;'&quot;)
objFolderSecuritySettings.GetSecurityDescriptor objSD
For Each objAce in objSD.DACL
    Select Case objAce.AccessMask
        Case 1179817
            strRights = &quot;read-only&quot;
        Case 2032127
            strRights = &quot;full-control&quot;
        Case 1245631
            strRights = &quot;change&quot;
    End Select
Wscript.Echo strUNCPathName &amp; &quot; ; &quot; &amp; strDir &amp; &quot; ; &quot; &amp; objAce.Trustee.Domain &amp; &quot; ; &quot; &amp; objAce.Trustee.Name &amp; &quot; ; &quot; &amp; strRights
Next
Set objSD = Nothing
Set objFolderSecuritySettings = 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%2Fwmi%2Fntfsrights%2Factive-directory-and-wmi-vbscript-to-enumerate-the-ntfs-rights-of-a-given-unc-path-and-a-given-level-of-subfolders%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/wmi/ntfsrights/active-directory-and-wmi-vbscript-to-enumerate-the-ntfs-rights-of-a-given-unc-path-and-a-given-level-of-subfolders/"></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/wmi/ntfsrights/active-directory-and-wmi-vbscript-to-enumerate-the-ntfs-rights-of-a-given-unc-path-and-a-given-level-of-subfolders/"  data-text="Active Directory and WMI: VBscript to enumerate the ntfs rights of a given UNC path and a given level of subfolders" 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/wmi/ntfsrights/active-directory-and-wmi-vbscript-to-enumerate-the-ntfs-rights-of-a-given-unc-path-and-a-given-level-of-subfolders/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/wmi/ntfsrights/active-directory-and-wmi-vbscript-to-enumerate-the-ntfs-rights-of-a-given-unc-path-and-a-given-level-of-subfolders/feed/</wfw:commentRss>
		<slash:comments>2</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 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>

