Page 1 of 1 1
Topic Options
#68941 - 2002-08-09 05:33 PM Total space used on a system
New Mexico Mark Offline
Hey THIS is FUN
****

Registered: 2002-01-03
Posts: 223
Loc: Columbia, SC
Is there a straightforward way to return the total space USED on a drive?

We are evaluating newer backup solutions, and I want to hack together a script to go to a group of NT/2K servers (about 100) and calculate the total space used on all local hard drives. I could do some ugly stuff with CMD Dir, but it would be painfully slow and, well... ugly.

These systems may not all have WMI installed. I searched on "drive space", but couldn't find anything directly relevant.

Any ideas?

Thanks!

NMM

Top
#68942 - 2002-08-09 05:36 PM Re: Total space used on a system
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Mark,

Does - GetDiskSpace work for you?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#68943 - 2002-08-09 05:39 PM Re: Total space used on a system
ITDEPT Offline
Fresh Scripter

Registered: 2002-06-11
Posts: 26
Loc: Edmonton, Alberta, Canada
Check this one out. It is a hardware inventory script with a bunch of disk space stuff you might be interested in.

http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=2;t=000738#000004

Top
#68944 - 2002-08-09 05:58 PM Re: Total space used on a system
New Mexico Mark Offline
Hey THIS is FUN
****

Registered: 2002-01-03
Posts: 223
Loc: Columbia, SC
Kent:

GetDiskSpace returns free space... I need total space used. Thanks, though.

ITDEPT:

I'll check that link out... sounds like what I'm looking for. Thanks.

NMM

Top
#68945 - 2002-08-09 06:05 PM Re: Total space used on a system
New Mexico Mark Offline
Hey THIS is FUN
****

Registered: 2002-01-03
Posts: 223
Loc: Columbia, SC
Looks like that inventory script is meant to be run locally. I need to check these servers remotely. It also doesn't return total drive space as far as I can tell.

Unfortunately, running winmsd is about as rough a way of doing this as running dir /s/a. There has to be a better way.

TIA

NMM

Top
#68946 - 2002-08-09 06:27 PM Re: Total space used on a system
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
there was a dirsize() udf.. but it parses every file, and will therefore take a long time...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#68947 - 2002-08-09 06:29 PM Re: Total space used on a system
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
ther is also chkdsk... but you can't run it remotely. You could schedule it and output to a logfile...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#68948 - 2002-08-09 06:30 PM Re: Total space used on a system
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what about getting disksize and reducing freespace from it?
_________________________
!

download KiXnet

Top
#68949 - 2002-08-09 06:49 PM Re: Total space used on a system
New Mexico Mark Offline
Hey THIS is FUN
****

Registered: 2002-01-03
Posts: 223
Loc: Columbia, SC
Getting disk size and subtracting free space from it would work, but I'm even stuck there.

I may just go back to a WMI solution and manually check the systems that fail with WMI.

Here is some interesting MS code.

code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk")
For each objDisk in colDisks
Wscript.Echo "Compressed: " & vbTab & objDisk.Compressed
Wscript.Echo "Description: " & vbTab & objDisk.Description
Wscript.Echo "DeviceID: " & vbTab & objDisk.DeviceID
Wscript.Echo "DriveType: " & vbTab & objDisk.DriveType
Wscript.Echo "FileSystem: " & vbTab & objDisk.FileSystem
Wscript.Echo "FreeSpace: " & vbTab & objDisk.FreeSpace
Wscript.Echo "MediaType: " & vbTab & objDisk.MediaType
Wscript.Echo "Name: " & vbTab & objDisk.Name
Wscript.Echo "QuotasDisabled: " & vbTab & objDisk.QuotasDisabled
Wscript.Echo "QuotasIncomplete: " & vbTab & objDisk.QuotasIncomplete
Wscript.Echo "QuotasRebuilding: " & vbTab & objDisk.QuotasRebuilding
Wscript.Echo "Size: " & vbTab & objDisk.Size
Wscript.Echo "SupportsDiskQuotas: " & vbTab & _
objDisk.SupportsDiskQuotas
Wscript.Echo "SupportsFileBasedCompression: " & vbTab & _
objDisk.SupportsFileBasedCompression
Wscript.Echo "SystemName: " & vbTab & objDisk.SystemName
Wscript.Echo "VolumeDirty: " & vbTab & objDisk.VolumeDirty
Wscript.Echo "VolumeName: " & vbTab & objDisk.VolumeName
Wscript.Echo "VolumeSerialNumber: " & vbTab & _
objDisk.VolumeSerialNumber
Next


Top
#68950 - 2002-08-09 07:47 PM Re: Total space used on a system
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
How about FileSystemObject:

code:
$objFSO = CreateObject("Scripting.FileSystemObject")
$Drives = $objFSO.Drives
For each $Drive in $Drives
If $Drive.Drivetype=2
? "Drive: " $Drive.Driveletter
? " Total Space: " $Drive.TotalSize
? " Free Space: " $Drive.FreeSpace
?
Endif
Next


Top
#68951 - 2002-08-09 08:16 PM Re: Total space used on a system
New Mexico Mark Offline
Hey THIS is FUN
****

Registered: 2002-01-03
Posts: 223
Loc: Columbia, SC
The problem with the file system object is that it is local. I need to check this on other systems. Looks like I'm stuck with WMI.

Thanks, though!

NMM

Top
#68952 - 2002-08-10 05:09 AM Re: Total space used on a system
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
NMM,

> Kent:

> GetDiskSpace returns free space... I need total space used. Thanks, though.

Yes.. If you got the (total size of the drive) - (free space) wouldn't that be what you are looking for?

Here is what we use to send to our admins.. It is batch and I am sure that it could be converted to Kix..

http://www.robvanderwoude.com/files/servers.txt

Instead of NET VIEW, we have it read (TYPE) from a list..

When complete, it e-mails us the .CSV file..

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#68953 - 2002-08-10 06:41 AM Re: Total space used on a system
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I think we have hope in there somewhere.
ms does not give any hits but simple STFW gives:
http://www.csharphelp.com/archives2/archive334.html

it does not fit, but maybe some day it will...
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 764 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.066 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org