Author Topic: disk usage  (Read 210 times)

kle2

  • Newbie
  • *
  • Posts: 19
disk usage
« on: April 28, 2022, 05:14:55 am »
I am trying to get the disk usage (C: D: E: etc...) remotely (or at least locally) for Windows servers.  Do you have any suggestion/command?  Thank you - Khoa

ChuckC

  • Sr. Member
  • ****
  • Posts: 390
Re: disk usage
« Reply #1 on: April 28, 2022, 06:05:46 am »
WMI [Windows Management Instrumentation] can be utilized in a WinBatch script.  Specifically, the class Win32_LogicalDisk can provide the information that you're looking for.  WMI can access both the local computer and remote computers, provided that the remote computers are configured to allow inbound requests to interact with WMI.

I'd recommend first searching the tech support database for articles about using WMI from WinBatch, do some reading and try out some of the script code in those articles.  Demonstrate to yourself that you can make it work.  Then adapt that code to specifically query a computer for all instances of Win32_LogicalDisk, iterate through them and obtain the desired information from each instance.

kle2

  • Newbie
  • *
  • Posts: 19
Re: disk usage
« Reply #2 on: April 28, 2022, 06:59:21 am »
Thanks for your suggestion, Chuck!  I found the reference code.  Khoa

https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsrch.web+~+TechHome

td

  • Tech Support
  • *****
  • Posts: 4062
    • WinBatch
Re: disk usage
« Reply #3 on: April 28, 2022, 07:18:01 am »
WinBatch also has the "DiskFree" function which reports the amount of unused disk space. You can find more information in the functions documentation in the Consolidated WIL Help file. The "Diskscan" function will obtain a list of drive letters.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

kle2

  • Newbie
  • *
  • Posts: 19
Re: disk usage
« Reply #4 on: April 28, 2022, 08:57:29 am »
Thank you, TD!