Windows – How to find a directory disk usage over network? (Windows)

disk-space-utilizationlocal-area-networkpowershellscriptingwindows

I have an external disk that is connected to a LAN network.
I want to find the disk usage of a directory on the disk from a script. I looked at power shell and SysInternals tools but couldn't find any solution. Any ideas?

Thanks.

Best Answer

Powershell makes it possible in the following way:

Size in MB

"Folder use {0:0,0.00} MB" -f (((Get-ChildItem -R C:\TEMP | measure-object length -Sum ).Sum / 1MB)

Size in GB

"Folder use {0:0,0.00} MB" -f (((Get-ChildItem -R C:\TEMP | measure-object length -Sum ).Sum / 1GB)

Maybe in TB

"Folder use {0:0,0.00} MB" -f (((Get-ChildItem -R C:\TEMP | measure-object length -Sum ).Sum / 1TB)