1 option explicit
2 dim xmlhttp
3 dim xmldoc
4 dim strrequest
5 dim ie
6
7 strrequest = "<?xml version=""1.0"" ?><D:propfind xmlns:D=""DAV:"" xmlns:E=""http://schemas.microsoft.com/mapi/proptag/""><D:prop><E:x0e080014 /></D:prop></D:propfind>"
8 Set xmlhttp = CreateObject("msxml2.xmlhttp")
9 Set xmldoc = CreateObject("Msxml2.DOMDocument")
10 xmldoc.loadXML(strrequest)
11
12 wscript.echo "Connecting to " & wscript.Arguments(0) & "..."
13 xmlhttp.Open "PROPFIND", wscript.Arguments(0), false, wscript.Arguments(1), wscript.arguments(2)
14 xmlhttp.setRequestHeader "Content-type:", "text/xml"
15 xmlhttp.setRequestHeader "Depth", "0"
16 xmlhttp.send strrequest
17 wscript.echo "Return status: " & xmlhttp.status & " " & xmlhttp.statustext
18
19 set xmldoc = xmlhttp.responseXml
20 if (xmlhttp.status = 207) then
21 xmldoc.setProperty "SelectionNamespaces", "xmlns:ex='http://schemas.microsoft.com/mapi/proptag/'"
22 wscript.echo "Size of folder: " & xmldoc.selectSingleNode("//ex:x0e080014").text & " Bytes"
23 end if
To use this script, simply copy it into a text file and save it as foldersize.vbs file. Then open a command prompt and type the following:
Where myserver is the exchange server that contains the folder you want to check and myfolder ist the name of the folder.