Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get drive sizes

Status
Not open for further replies.

bentley45

MIS
Jul 15, 2004
120
US
I was using a W2k pro station. I have just upgraded to XP. Periodically, I need to UNC to servers and check the drive space, basically '\\servername\c$'. Under W2k pro, it would show the free space in the left pane, but with XP, it will not.

Is there any way to turn that feature on?
Thanks!
 
I wrote a small VBscript program that will check total space on a drive (you don't have check the UNC path). Run the program and enter the server name and it will give you the free space for each of your drives. It isn't pretty but it works;

Const HARD_DISK = 3
Const GIGABYTE = 1073741824 'lists disk size in GB ie 1024x1024x1024

strComputer = InputBox("Enter Computername" , "Check Disk Space")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colDisks = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")


For Each objDisk in colDisks
Wscript.Echo "DeviceID: "& " " & objDisk.DeviceID & " " & "Total Disk Space: "& " " & Round(objDisk.Size/GIGABYTE,2) & "GB " & " Total Used: "& " " & (Round(objDisk.Size/GIGABYTE,2))-(Round(objDisk.FreeSpace/GIGABYTE,2))& " GB"
Next

 
Why don't you just use Computer Management/Disk Management and connect to the target computer?

You could also run a tool like SIW - under the hardware section in the system info summary it will tell you this information.

Of course, the script is great if you want this information from multiple computers at one time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top