#39274 - 2003-04-16 09:50 PM
Total size of local disk(s)
|
chadm
Lurker
Registered: 2003-04-16
Posts: 2
|
We have found how to find the available space of a local disk (C:\, D:\ for example). We want to report on the total size of the local disk(s). Is this possible?
We are trying not to avoid using WMI because it causes problems for us.
Thanks for any help.
Chad [ 16. April 2003, 22:55: Message edited by: chadm ]
|
|
Top
|
|
|
|
#39275 - 2003-04-17 01:42 AM
Re: Total size of local disk(s)
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
Welcome to the kixtart club.
Indeed there is solution for it. Take a look at topic
Disksize, which handles about our script disksize.zip which you can find on our site ("Home - kix scripts" or "Summary of Site"). greetings.
btw: take also a look at the mappings.kix script on our site.
btw: symbol on our pages has been linked to related http://kixtart.org topic. [ 17. April 2003, 01:43: Message edited by: MCA ]
|
|
Top
|
|
|
|
#39276 - 2003-04-17 02:26 AM
Re: Total size of local disk(s)
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
How about...
code:
Break On
$objFSO = CreateObject("Scripting.FileSystemObject") $objDrive = $objFSO.GetDrive("C:") "Drive " + $objDrive.DriveLetter + ": "+ $objDrive.VolumeName ? "Available Space: " + FormatNumber($objDrive.AvailableSpace/1024, 0) + " Kbytes" ? "Free Space: " + FormatNumber($objDrive.FreeSpace/1024, 0) + " Kbytes" ? "Total Size: " + FormatNumber($objDrive.TotalSize/1024, 0) + " Kbytes" ?
...as an alternative to WMI?
|
|
Top
|
|
|
|
#39277 - 2003-04-17 03:02 PM
Re: Total size of local disk(s)
|
chadm
Lurker
Registered: 2003-04-16
Posts: 2
|
Thanks everyone, we will look into both solutions!
Chad
|
|
Top
|
|
|
|
#39278 - 2003-04-17 07:07 PM
Re: Total size of local disk(s)
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11634
Loc: Space
|
Chris,
I like your suggestion too. What is the minimum IE or OS version supported using this method?
I made a couple changes, but only for my own preference, other users may not agree.
Removed the Kbytes as MB or GB might be a better term, but I did not want to add code to change name. Numbers alone should be good enough. Added $objFSO="" to destroy the object at the end of the code Added another var for the drive to use. Removed the term Available, as Freespace and Available seem to be the same. Can you explain the difference between the two? Posted with PostPrep to make copying the code from the board much easier to use.
Break On $Drive='c:' $objFSO = CreateObject("Scripting.FileSystemObject") $objDrive = $objFSO.GetDrive("$Drive") "Drive " + $objDrive.DriveLetter + ": "+ $objDrive.VolumeName ? "Total Size: " + FormatNumber($objDrive.TotalSize/1024, 0) ? "Free Space: " + FormatNumber($objDrive.FreeSpace/1024, 0) ? $objFSO=""
Here is an example of the returned value for me.
quote:
Drive C: Local Disk Total Size: 70,332,570 Free Space: 8,350,456
Drive D: Total Size: 117,218,240 Free Space: 58,923,272
Chris, also a minor observation. Notice my drives above. C: says Local Disk but the D: drive does not say Local Disk. Both are physical hard drives, not extended partitions. I have two drives on the system. Why doesn't D: say Local Disk? [ 17. April 2003, 19:10: Message edited by: NTDOC ]
|
|
Top
|
|
|
|
#39279 - 2003-04-17 08:12 PM
Re: Total size of local disk(s)
|
Chris S.
MM club member
   
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Doc, the File System Object is included with WSH. As far as I know it has not been upgraded so the methods listed above should work with any version of WSH. According to Technet: The minimum requirement for WSH to function is Internet Explorer version 3.0 or later.
For a more complete reference on the FSO object see: FSO Reference
Your C: drive says "Local Disk" because its your drive label. You probably don't remember setting that, but Win 2000/XP kinda puts it in there by default.
There are a few more things that FSO is useful for, like determining CD-Rom drives etc. I could probably make some UDF out of them. [ 17. April 2003, 20:42: Message edited by: Chris S. ]
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 766 anonymous users online.
|
|
|