How Can I Determine the Size of the 'My Documents' Folder for every user on a local machine using VBScript?

Hello,
I am at my wits end into this. Either I am doing it the wrong way or it is not possible.
Let me explain. I need a vb script for the following scenario:
1. The script is to run on multiple Windows 7 machines (32-Bit & 64-Bit alike).
2. These are shared workstation i.e. different users login to these machines from time to time.
3. The objective of this script is to traverse through each User Profile folder and get the size of the 'My Documents' folder within each User Profile folder. This information is to be written to a
.CSV file located at C:\Temp directory on the machine.
4. This script would be pushed to all workstations from SCCM. It would be configured to execute with
System Rights
I tried the script detailed at:
http://blogs.technet.com/b/heyscriptingguy/archive/2005/03/31/how-can-i-determine-the-size-of-the-my-documents-folder.aspx 
Const MY_DOCUMENTS = &H5&
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_DOCUMENTS)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path
Set objFolder = objFSO.GetFolder(strPath)
Wscript.Echo objFolder.Size
The Wscript.Echo objFolder.Size command in the script at the above mentioned link returned the value as
'0' (zero) for the current logged on user. Although the actual size was like 30 MB or so.
I then tried the script at:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_27869829.html
This script returns the correct value but only for the current logged-on user.
Const blnShowErrors = False
' Set up filesystem object for usage
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
' Display desired folder sizes
Wscript.Echo "MyDocuments : " & FormatSize(FindFiles(objFSO.GetFolder(objShell.SpecialFolders("MyDocuments"))))
' Recursively tally the size of all files under a folder
' Protect against folders or files that are not accessible
Function FindFiles(objFolder)
On Error Resume Next
' List files
For Each objFile In objFolder.Files
On Error Resume Next
If Err.Number <> 0 Then ShowError "FindFiles:01", objFolder.Path
On Error Resume Next
FindFiles = FindFiles + objFile.Size
If Err.Number <> 0 Then ShowError "FindFiles:02", objFile.Path
Next
If Err.Number = 0 Then
' Recursively drill down into subfolder
For Each objSubFolder In objFolder.SubFolders
On Error Resume Next
If Err.Number <> 0 Then ShowError "FindFiles:04", objFolder.Path
FindFiles = FindFiles + FindFiles(objSubFolder)
If Err.Number <> 0 Then ShowError "FindFiles:05", objSubFolder.Path
Next
Else
ShowError "FindFiles:03", objFolder.Path
End If
End Function
' Function to format a number into typical size scales
Function FormatSize(iSize)
aLabel = Array("bytes", "KB", "MB", "GB", "TB")
For i = 0 to 4
If iSize > 1024 Then iSize = iSize / 1024 Else Exit For End If
Next
FormatSize = Round(iSize, 2) & " " & aLabel(i)
End Function
Sub ShowError(strLocation, strMessage)
If blnShowErrors Then
WScript.StdErr.WriteLine "==> ERROR at [" & strLocation & "]"
WScript.StdErr.WriteLine " Number:[" & Err.Number & "], Source:[" & Err.Source & "], Desc:[" & Err.Description & "]"
WScript.StdErr.WriteLine " " & strMessage
Err.Clear
End If
End Sub
The only part pending, is to achieve this for the 'My Documents' folder within each User Profile folder.
Is this possible?
Please help.

Here are a bunch of scripts to get folder size under all circumstances.  Take your pick.
https://gallery.technet.microsoft.com/scriptcenter/site/search?query=get%20folder%20size&f%5B0%5D.Value=get%20folder%20size&f%5B0%5D.Type=SearchText&ac=2
¯\_(ツ)_/¯

Similar Messages

  • How can you transfer from Pages to epson iprint document folder for printing

    I have my epson printer recognized by the app. but cannot work out how to get my documents into the epson iprint app. Thatnis how doesnone transfer documents form Pages to the documents section of the iprint app.
    Also can you place more than 1 photo per page. Epson support could not help.  Thanks steve

    http://www.epson.com.au/iprint/
    Epson iPrint Ver 2.0 - Frequently Asked Questions
    Q1. Are iWorks files supported by the app?
    A1. No
    Peter

  • How can I determine what dns server the wifi client use within airport

    How can I determine what dns server the wifi client use within airport
    I want to use dns servers other then the one that airport extreme is using. For example I got the 172.16.1.1 (the default gateway - airport extreme), but I want to use the office dns servers, that are in a 10.x.x.x range.
    Is there a possibility?
    Thanks and happy eastern

    The Airport Extreme uses the DNS servers assigned by the network that it connects to. Is you Airport Extreme on the 10.x.x.x network? if it is then you are already using the 10.x.x.x DNS servers. Check your Airport Extreme with the Airport Utility and you will see in the Internet tab, the DNS servers used. The devices connecting to the Airport Extreme are assigned a DNS address of the Airport Extremes IP, In your case 172.16.1.1 but all DNS searches and resolution are done with the DNS servers you see in the Airport Extreme.
    If you want to use some other DNS then you can override in the Airport Extreme which will be used by all devices connecting too the Airport Extreme, Or you can edit the DNS address in each devices wireless settings.

  • How can I combine all of my music into one folder for itunes

    I have a PC running windows XP I have just bought a IPad 3 and I am trying to consolidate all my music into one folder on one drive so that the sync does not have a problem finding many tracks every time I connect my IPad please can anyone help.
    Kind Regards
    Derek

    Hi Derek. Do you know where your active iTunes library is? If not download & run the script iTunesInfo which should output something like this:
    I'm interested in the values of the first four lines. If needed you can hide your username with <User> if it's in there. Also worth checking that media folder location given by the script agrees with Edit > Preferences > Advanced. If not, let me know.
    Which of your drives has the most free space? Ideally you should move your current library to that drive as X:\iTunes (when X: is the drive letter) and then consolidate all your existing content that wasn't inside the current iTunes Media folder. I can descibe what to do on a generic basis but with the details I can produce a step-by-step guide that will be easier to follow.
    tt2

  • How do I determine array size in a formula node

    I am feeding an array into a formula node to perform an operation on. However the size of the array can be an arbitrary size. How can I determine its size to use for iterating through a for loop?
    I suppose that I could add another input that is fed with the array size from the array palate but I would like to know if it can be done inside the formula node itself.

    Your own advice is the only and best one.
    greetings from the Netherlands

  • How can I see page size?

    How can I see page size of the open document?

    This functionality is not available in Adobe Reader for Android. Could you please let us know how and why you would you like to see this feature so that we could add it to our product backlog?
    Thanks,
    Adobe Reader Team

  • How can I determine the number and sizes of redologs?

    Dear all,
    How can I determine the number and sizes of redologs are sufficient to allow redo log switching while hot backup is in progress?
    Please advice,
    Amy

    Two questions here - what the OP put as the subject title and what was asked in the thread, which are different questions.
    I would interpret the question in the thread to mean "how to avoid hanging due to archiving waiting for a redo log group to become available." Alert log, wait events, and user complaints would be the source of information here.

  • For the life of me, I can't find out what size a photo is in terms of inches or how to change the size of the photo[s] so I can print them. I think I read somewhere to click edit, then click adjust. Nothing there about sizing.

    For the life of me, I can't find out what size a photo is in terms of inches or how to change the size of the photo[s] so I can print them. I think I read somewhere to click edit, then click adjust. I don't see anything about re-sizing when I click the adjust tab: only saturation and tint levels. Thank you.

    With respect to digital images, there really is no size in inches. The size is given as number of pixels horizontally and vertically. In iPhoto '09 you click the little "i" inthe lower right side of the window and it will display information related to the selected photo, including the pixel dimensions. I do not have iPhoto '11 installed so I don't know if it is the same there.
    In some applications, such as preview, it has something additional called Dots per Inch (DPI) which you would think would allow you to convert the pixel dimensions to inches. It is not a real thing, though. The DPI is determined by how large or small you have chosen to print your photo and the capabilities of your printer. 
    There is also something called Aspect Ratio, which is usually expressed in inches x inches such as 6x9 but that doesn't mean the size on the screen or when printed is 6x9.  It is the ratio of the pixel dimensions.  When cropping your photos, you will have several standard aspect ratios to choose from plus any custom ones you create.
    In iPhoto '09, after you choose Print, in the Print Setting window are the settings for the size you want the photo printed. You want to shoose a setting with the same aspect ratio of your photo. Otherwise, iPhoto will resize and/or crop your photo to fit the size you have chosen. 

  • How can I control the size of the af:InputText?

    Hi,
    How can I control the size of the 'af:InputText' on the UI, without using columns & rows attributes. Even though I am using width & height attributes, the changes are not getting reflected in the UI.
    Thanks,
    Rajesh.

    Hi,
    It is inside a 'af:PanelBox'. So, the parent container also determines the size of the child? Here I need a create a 'pidgin chat window' kind of an interface with a fixed size top-level container, inside which I willl put all my components. The code looks something like this:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1" partialTriggers="it1">
    <af:messages id="m4"/>
    <af:form id="f1" partialTriggers="it1">
    <af:panelBox text="" id="pb1" background="dark" type="stretch"
    titleHalign="start" ramp="highlight"
    inlineStyle="width:350pt; height:500pt; margin:0.5pt; padding:0.5pt; border-width:0.5pt; "
    partialTriggers="it1">
    <af:spacer height="15pt" id="s1"/>
    <af:inputText id="ot1"
    columns="82" rows="25" wrap="hard"
    partialTriggers="it1"
    value="#{ChatClientBean.chatLog}"
    binding="#{ChatClientBean.outputChatTextBox}"
    visible="false">
    </af:inputText>
    <af:spacer height="27pt"/>
    <af:inputText id="it1" inlineStyle="width:200pt; height:100pt;"
    valueChangeListener="#{sessionScope.ChatClientBean.sendMessage}"
    autoSubmit="true" partialTriggers="it1"
    binding="#{ChatClientBean.inputChatText}"/>
    </af:panelBox>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    Thanks,
    Rajesh.

  • Async tcp client and server. How can I determine that the client or the server is no longer available?

    Hello. I would like to write async tcp client and server. I wrote this code but a have a problem, when I call the disconnect method on client or stop method on server. I can't identify that the client or the server is no longer connected.
    I thought I will get an exception if the client or the server is not available but this is not happening.
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    How can I determine that the client or the server is no longer available?
    Server
    public class Server
    private readonly Dictionary<IPEndPoint, TcpClient> clients = new Dictionary<IPEndPoint, TcpClient>();
    private readonly List<CancellationTokenSource> cancellationTokens = new List<CancellationTokenSource>();
    private TcpListener tcpListener;
    private bool isStarted;
    public event Action<string> NewMessage;
    public async Task Start(int port)
    this.tcpListener = TcpListener.Create(port);
    this.tcpListener.Start();
    this.isStarted = true;
    while (this.isStarted)
    var tcpClient = await this.tcpListener.AcceptTcpClientAsync();
    var cts = new CancellationTokenSource();
    this.cancellationTokens.Add(cts);
    await Task.Factory.StartNew(() => this.Process(cts.Token, tcpClient), cts.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
    public void Stop()
    this.isStarted = false;
    foreach (var cancellationTokenSource in this.cancellationTokens)
    cancellationTokenSource.Cancel();
    foreach (var tcpClient in this.clients.Values)
    tcpClient.GetStream().Close();
    tcpClient.Close();
    this.clients.Clear();
    public async Task SendMessage(string message, IPEndPoint endPoint)
    try
    var tcpClient = this.clients[endPoint];
    await this.Send(tcpClient.GetStream(), Encoding.ASCII.GetBytes(message));
    catch (Exception exception)
    private async Task Process(CancellationToken cancellationToken, TcpClient tcpClient)
    try
    var stream = tcpClient.GetStream();
    this.clients.Add((IPEndPoint)tcpClient.Client.RemoteEndPoint, tcpClient);
    while (!cancellationToken.IsCancellationRequested)
    var data = await this.Receive(stream);
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    private async Task Send(NetworkStream stream, byte[] buf)
    await stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
    await stream.WriteAsync(buf, 0, buf.Length);
    private async Task<byte[]> Receive(NetworkStream stream)
    var lengthBytes = new byte[4];
    await stream.ReadAsync(lengthBytes, 0, 4);
    var length = BitConverter.ToInt32(lengthBytes, 0);
    var buf = new byte[length];
    await stream.ReadAsync(buf, 0, buf.Length);
    return buf;
    Client
    public class Client
    private TcpClient tcpClient;
    private NetworkStream stream;
    public event Action<string> NewMessage;
    public async void Connect(string host, int port)
    try
    this.tcpClient = new TcpClient();
    await this.tcpClient.ConnectAsync(host, port);
    this.stream = this.tcpClient.GetStream();
    this.Process();
    catch (Exception exception)
    public void Disconnect()
    try
    this.stream.Close();
    this.tcpClient.Close();
    catch (Exception exception)
    public async void SendMessage(string message)
    try
    await this.Send(Encoding.ASCII.GetBytes(message));
    catch (Exception exception)
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.SafeInvoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    private async Task Send(byte[] buf)
    await this.stream.WriteAsync(BitConverter.GetBytes(buf.Length), 0, 4);
    await this.stream.WriteAsync(buf, 0, buf.Length);
    private async Task<byte[]> Receive()
    var lengthBytes = new byte[4];
    await this.stream.ReadAsync(lengthBytes, 0, 4);
    var length = BitConverter.ToInt32(lengthBytes, 0);
    var buf = new byte[length];
    await this.stream.ReadAsync(buf, 0, buf.Length);
    return buf;

    Hi,
    Have you debug these two applications? Does it go into the catch exception block when you close the client or the server?
    According to my test, it will throw an exception when the client or the server is closed, just log the exception message in the catch block and then you'll get it:
    private async void Process()
    try
    while (true)
    var data = await this.Receive();
    this.NewMessage.Invoke(Encoding.ASCII.GetString(data));
    catch (Exception exception)
    Console.WriteLine(exception.Message);
    Unable to read data from the transport connection: An existing   connection was forcibly closed by the remote host.
    By the way, I don't know what the SafeInvoke method is, it may be an extension method, right? I used Invoke instead to test it.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I determine the type of video out connector I need?

    Howdy,
    I have a white macbook purchased Jun/2008. I want to connect to a TV but don't know what adapter I need. How can I determine the type of video out jack my macbook has?
    System Profiler says the model identifier is "MacBook 4,1". Under Graphics/Displays the only thing it says about the "Display Connector" is that no display is connected. Too bad it doesn't tell me what type of connector it is. If I knew the name of the connector I'd probably be home free. But it seems like every macbook model has a different video connector (since the state of the art has advanced over the years) and I haven't been able to keep up with the names.
    Now, I have a 6" long adapter that will convert this connector to VGA. And searching the Apple store for VGA adapters, the existence of mine says my connector is might be one of "Mini DisplayPort", "Apple Mini DVI", "Apple DVI", or "Apple Micro-DVI". But then there is also the connector at
    http://store.apple.com/us/product/M8639G/A?mco=MTY3ODQ5OTY
    and that looks like the one I have. But unlike the other adapters, this one is just called a "VGA Display Adapter". Does the connector have a name? How can I find adapters that have that same connector?
    I know I could use the adapter I have, plus a VGA to VGA cable, to hook up to a TV. But the quality of the VGA signal is poor in the digital world. My goal is to hook up to the TV via HDMI. Is this even possible? By which I mean, will my macbook generate the signals necessary to be able to be converted to HDMI?
    Thanks for any help,
    Zebulon T

    Thanks, Ded,
    You're right, the cable that I have won't work. I't from my previous, 2004 iBook. This is pretty embarrassing... I looked at the cable but didn't bother to try plugging it in.
    Looking at the close-up picture of the Mini-DVI to VGA adapter, that does look like the right connector. So I have Mini-DVI, and the other apter you pointed to can convert this to DVI. I'll take a look to see what makes the most sense, connector wise, downstream from that.
    Thanks very much.
    Zeb T

  • When I upgraded from v4 to v5 my bookmarks was lost. I do have the one that is in the firefox toolbar. Apparently I had a bookmarks add-on. V5 changed my browser how can I determine what the program was and if the bookmarks are still there?

    When I upgraded from v4 to v5 my bookmarks was lost. I do have the one that is in the firefox toolbar. Apparently I had a bookmarks add-on. V5 changed my browser how can I determine what the program was and if the bookmarks are still there?

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Websites remembering you and automatically log you in is stored in a cookie.
    *Create an allow Cookie Exception to keep such a cookie, especially for secure websites and if cookies expire when Firefox is closed.
    *Tools > Options > Privacy > Cookies: Exceptions
    In case you are using "Clear history when Firefox closes":
    *do not clear Cookies
    *do not clear Site Preferences
    *Tools > Options > Privacy > Firefox will: "Use custom settings for history": [X] "Clear history when Firefox closes" > Settings
    *https://support.mozilla.org/kb/Clear+Recent+History
    Note that clearing "Site Preferences" clears all exceptions for cookies, images, pop-up windows, software installation, and passwords.
    Clearing cookies will remove all specified (selected) cookies including cookies that have an allow exception and cookies from plugins.

  • How can I print a pdf in the actual size with a page border?

    How can I print a pdf in the actual size with a page border? (2 pages per sheet preferred)
    I usually print pdfs of books at a copy shop and they turn out fine.
    The problem comes when I try to print the same books at home.
    I use Adobe Acrobat X with the same settings: "multiple pages per sheet" (2x1) and page border. But the pages are slightly shrunken when printed. I think this is because my printer can't print as closely to the margins. Still, two pages should be able to fit on one sheet in actual size. Are there any layout settings that I can play with to find a better fit, besides portrait and landscape?
    If I select page scaling "none," I'm able to print the pdf in actual size, one page per sheet. But there's no option to add a page border.

    I have a test with some questions (multiple choice, FIB, matching, etc). I have just one button to submit all the answers, and after submiting the student can see his score and review the test to know where he failed. He can't answer again. However, he can change the answer multiple times before submiting.
    "if i turn on success/failure captions the student will see them while answering" - before submitting
    "if i turn them off he wont know what's the right answer" - after submitting
    My results page is the default. I didn't use any variable. When i go to the results page after reviewing the test all the entry boxes are "wrong".

  • How can you determine the absolute path to a dynamically created NetStream object?

    We are trying to implement video captioning with a freeware component, ccforflash. This requires us to provide an absolute or relative path  to our NetStream object. How can we determine this path in Flash CS5 AS3?
    From the CCforFlashCS5 documentation:
    "2. Object name and path
    Type the name and path.  This is the instance name of the object with which CCforFlashAS3 will synchronize. It must be spelled correctly, since CCforFlashAS3 will query the object with this name for timing information in order to synchronize the captions. The path must also be included; either relative to the CCforFlashAS3 component (i.e. this.parent) or the absolute path from the main level of the movie (root)."

    It would be easier if the NetStream object was created on an easily identifiable place on the timeline. This player has an MVC architecture. The NetStream object is created in a subclass to Model class, which is itself a subclass of the EventDispatcher object. The View class access it via an interface.
    As you can guess, it's not that straightforward to determine where the NetStream object is located on the timeline. This is compounded by the fact that the NetStream object does not have a name property.
    I've tried methods like these, but they only work for the DisplayObject class:
    public static function displayObjectPath( avDisplayObject : DisplayObject ) :String
    var lvPath:String = "";
    do
    if( avDisplayObject.name ) {
    // var obj_name:String = (avDisplayObject.name == 'root1') ? 'root' : avDisplayObject.name;
    if (avDisplayObject.name != 'root1') {
    lvPath = avDisplayObject.name
       + ( lvPath == "" ? "" : "." + lvPath );
    } else {
    trace("displayObjectPath() NO NAME avDisplayObject="+avDisplayObject);
    } while( avDisplayObject = avDisplayObject.parent );
    return lvPath;
    } // displayObjectPath
    private  function showChildren(d:DisplayObjectContainer):void {
    trace("showChildren()");
    if (d.numChildren>0) {
    for (var c:Number = 0; c < d.numChildren; c++) {
    trace("showChildren c=",c," name=",d.getChildAt(c).name);

  • I am shooting with a Nikon D60 on Fine Format and unable to print larger than 11x14.  I have been able to print larger pictures.  I am told iPhoto reduces the size of the file when uploaded. Is this true? If so how can I change this?  I need 16x20's

    I am shooting with a Nikon D60 on Fine Format and unable to print larger than 11x14.  I have been able to print larger pictures.  I am told iPhoto reduces the size of the file when uploaded. Is this true? If so how can I change this?  I need 16x20's

    I am shooting with a Nikon D60 on Fine Format and unable to print larger than 11x14.  I have been able to print larger pictures.  I am told iPhoto reduces the size of the file when uploaded. Is this true? If so how can I change this?  I need 16x20's

Maybe you are looking for

  • Copy and paste problem

    Yesterday something strange began happening. I copied all of the text in a document, opened a new page and pasted. However, the paste put what appears to be a text box on the new page. When I dragged the borders to the page size, I only had one page

  • I'm bald and have no hair to tear out, but if I di...

    I had typed i nice message about my speed loss but it was wiped when I tried to post so here's my new one. no frills old speed 600kb/s new speed 30kb/s - has been this way for 9-10 days, today was first day i reset router. no change nothing has chang

  • USB 2.0 Card Issue After Waking - Solution?

    I know this issue has been discussed a number of places, and I have read a lot of the threads. I was curious though if anyone has found a solution to the issue of USB cards not working after waking from sleep. I have read that the thumb drive seems t

  • Widows XP - Concurrent Manager - Target node/queue unavailable!

    Dear All, Need help to run concurrent Manager, all services are up, started, but all request are inactive, no manager, I tried my best to solve this problem thru metalink, updating FND......, its activating and suddenly status changing to target node

  • I need help.. My front and back camera suddenly stop working.

    Few days ago, my front and back cmaera stop working. I tried all the possible options but still having the same problems.