Page 1 of 1 1
Topic Options
#46012 - 2003-09-24 10:13 PM Size of physical disk
YaleCoder Offline
Getting the hang of it

Registered: 2001-12-18
Posts: 61
Loc: Jelenia Gora, Poland
I am trying to identify the capacity of the physical disk the operating system booted from, regardless of how many logical partitions are present. Is there a WMI class that will provide me with that info? If not, any input on how to go about it?

Thanks,
Matthew
_________________________
"When fascism comes to America, it will be wrapped in the flag, carrying a cross."
Sinclair Lewis

Top
#46013 - 2003-09-24 10:15 PM Re: Size of physical disk
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Yes, there is a class. See GetDiskSize() - get the size of a disk in bytes
_________________________
There are two types of vessels, submarines and targets.

Top
#46014 - 2003-09-24 10:25 PM Re: Size of physical disk
YaleCoder Offline
Getting the hang of it

Registered: 2001-12-18
Posts: 61
Loc: Jelenia Gora, Poland
Doesn't this require me to pass a logical drive letter as a variable?
_________________________
"When fascism comes to America, it will be wrapped in the flag, carrying a cross."
Sinclair Lewis

Top
#46015 - 2003-09-24 10:58 PM Re: Size of physical disk
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Try this:


$objWMI = GetObject("winmgmts:{impersonationlevel=impersonate}!//" + @WKSTA)
$Disk = $objWMI.ExecQuery("select * from Win32_DiskDrive")

For Each $item In $Disk
$size = $item.size
? "Size is: " + $size
Next
$objWMI = 0


Search MSDN for Win32_DiskDrive for other properties.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#46016 - 2003-09-24 11:02 PM Re: Size of physical disk
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
and WMIQuery...

$HD =WMIQuery("Size","Win32_DiskDrive")[0]
$hdGB =left($hd,len($hd)-9)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#46017 - 2003-09-25 02:52 PM Re: Size of physical disk
YaleCoder Offline
Getting the hang of it

Registered: 2001-12-18
Posts: 61
Loc: Jelenia Gora, Poland
Thank you very much for the help. I used WMIQuery and it works great. I'm getting there, hopefully in time, Ill be able to answer some questions!!
_________________________
"When fascism comes to America, it will be wrapped in the flag, carrying a cross."
Sinclair Lewis

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1808 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.44 seconds in which 0.303 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