HDD size
Moderator: DosItHelp
-
- Posts: 43
- Joined: 12 Dec 2021 06:45
HDD size
Happy Christmas friends.
My question is regarding the actual size of the Hard Drive, and I say actual size to refer to the total size of the drive.
I am aware that with this line I can know the size of the hard disk
WMIC DiskDrive WHERE "DeviceID='\\\\.\\PHYSICALDRIVE0'" GET Size
But I wonder if this same code will give the real size of the hard disk even though one of its partitions is NOT active.
The fact is that, in my work there are laptops to which a 320GB image is cloned on a 500GB disk, and in order not to go around so many times to find out the exact size of the disk, and do it all from the same batch, I wanted to know if this is the correct way to get the size or there is a different way to get the correct size.
First of all, thanks for the help you can give me.
I apologize for my English, I use a translator.
My question is regarding the actual size of the Hard Drive, and I say actual size to refer to the total size of the drive.
I am aware that with this line I can know the size of the hard disk
WMIC DiskDrive WHERE "DeviceID='\\\\.\\PHYSICALDRIVE0'" GET Size
But I wonder if this same code will give the real size of the hard disk even though one of its partitions is NOT active.
The fact is that, in my work there are laptops to which a 320GB image is cloned on a 500GB disk, and in order not to go around so many times to find out the exact size of the disk, and do it all from the same batch, I wanted to know if this is the correct way to get the size or there is a different way to get the correct size.
First of all, thanks for the help you can give me.
I apologize for my English, I use a translator.
Re: HDD size
I don't know. However, since DiskDrive targets the physical drive, I would not expect that partitions affect the output.
Steffen
Steffen
Re: HDD size
I also don't know that and would expect it to work lke aGerman assumed; but you might test that for yourself, since you already seem to have such a setup (maybe you could get the information of all hdds remotely and check of one differs too muc; my partitions don't sum up to the disk size, which probably is caused by some sort of 'security distance' between the partitions):
Please let us know the answer to that .
penpen
Code: Select all
wmic partition get name,size
wmic diskDrive get name,size
penpen
-
- Posts: 43
- Joined: 12 Dec 2021 06:45
Re: HDD size
aGerman y penpen, thank you very much for answering
i
But, when executing the Batch from a pendrive, I showed me the size of the pendrive and not the hard drive, so change to this code: Wmic DiskDrive Where "DeviceID='\\\\.\\PhysicalDrive0'" Get Size.
The problem is that I could not try the batch in the laptops whose 500GB HDD are cloned with 320GB image.
So we'll have to wait a few days (since we're on vacation) to be able to determine if the command brings the actual size.
Grateful as usual for the help they give me, and I promise that I will inform the results.
Note: I apologize for my English, use translator.
I agree with you, but before the doubt I had to ask.
i
This line used it when I began to create the Batch: “wmic diskDrive get size”, Since I am interested in assigning the size of the HDD to a variable to check.penpen wrote: ↑27 Dec 2021 08:35I also don't know that and would expect it to work lke aGerman assumed; but you might test that for yourself, since you already seem to have such a setup (maybe you could get the information of all hdds remotely and check of one differs too muc; my partitions don't sum up to the disk size, which probably is caused by some sort of 'security distance' between the partitions):Please let us know the answer to that .Code: Select all
wmic partition get name,size wmic diskDrive get name,size
penpen
But, when executing the Batch from a pendrive, I showed me the size of the pendrive and not the hard drive, so change to this code: Wmic DiskDrive Where "DeviceID='\\\\.\\PhysicalDrive0'" Get Size.
The problem is that I could not try the batch in the laptops whose 500GB HDD are cloned with 320GB image.
So we'll have to wait a few days (since we're on vacation) to be able to determine if the command brings the actual size.
Grateful as usual for the help they give me, and I promise that I will inform the results.
Note: I apologize for my English, use translator.
Re: HDD size
The diskdrive size is the size reported for the drive, and its contained partitions have no bearing on it.
You could find out with a 'quick' command in the prompt…
This should output your disks, their sizes, then the partitions with their sizes too:
Based upon your last post, if you want to save the size of the Operating System disk to a variable, using a batch file, then the following method should do that. The last line is included just to show you the variablename and value, you could of course use %DiriveSize%, for your comparison.
And to just see its size directly in a Command Prompt window, you could use this:
You could find out with a 'quick' command in the prompt…
This should output your disks, their sizes, then the partitions with their sizes too:
Code: Select all
For /F "EOL=_ Tokens=1,* Delims==" %G In ('((Echo DiskDrive Get Name^, Size /Value ^& Echo DiskDrive Assoc:List /ResultClass:Win32_DiskPartition^) 2^>NUL ^| %SystemRoot%\System32\wbem\WMIC.exe^) ^| %SystemRoot%\System32\findstr.exe /R "^Name= ^Size="') Do @Echo %H
Code: Select all
@Echo Off
SetLocal EnableExtensions DisableDelayedExpansion
Set "DriveSize="
For /F "Tokens=2 Delims=#," %%G in ('%SystemRoot%\System32\wbem\WMIC.exe
LogicalDisk Where "DeviceID='%SystemDrive%'"
Assoc /ResultClass:Win32_DiskPartition 2^>NUL'
) Do For /F "EOL=S" %%H In ('%SystemRoot%\System32\wbem\WMIC.exe DiskDrive Where
"Index='%%G'" Get Size 2^>NUL') Do For %%I In (%%H) Do Set "DriveSize=%%I"
(Set DriveSize) 2>NUL
Code: Select all
For /F "Tokens=2 Delims=#," %G in ('%SystemRoot%\System32\wbem\WMIC.exe LogicalDisk Where "DeviceID='%SystemDrive%'" Assoc /ResultClass:Win32_DiskPartition 2^>NUL') Do @%SystemRoot%\System32\wbem\WMIC.exe DiskDrive Where "Index='%G'" Get Size /Value
-
- Posts: 43
- Joined: 12 Dec 2021 06:45
Re: HDD size
Compo, thanks for replying.
I have added this to the .Batch, I just need to see the results when the holidays are over.
I'll tell you how it all turned out.
Thankful as always for the help you give me.
I have added this to the .Batch, I just need to see the results when the holidays are over.
I'll tell you how it all turned out.
Thankful as always for the help you give me.
-
- Posts: 43
- Joined: 12 Dec 2021 06:45
Re: HDD size
I apologize for the delay in responding, work activities increased to such an extent that I had not been able to do tests and enter the forum to report the results.
I also want to thank Compo, aGerman, and penpen for their input.
The codes worked as expected.
first method
second method
Thank you as always for the help you have given me.
Resolved issue.
I also want to thank Compo, aGerman, and penpen for their input.
The codes worked as expected.
first method
Code: Select all
For /f "tokens=*" %%f in ('WMIC DiskDrive WHERE "DeviceID='\\\\.\\PHYSICALDRIVE0'" GET Size /value ^| find "="') do set "%%f"
Code: Select all
SetLocal EnableExtensions DisableDelayedExpansion
For /F "Tokens=2 Delims=#," %%G in ('%SystemRoot%\System32\wbem\WMIC.exe
LogicalDisk Where "DeviceID='%SystemDrive%'"
Assoc /ResultClass:Win32_DiskPartition 2^>NUL'
) Do For /F "EOL=S" %%H In ('%SystemRoot%\System32\wbem\WMIC.exe DiskDrive Where
"Index='%%G'" Get Size 2^>NUL') Do For %%I In (%%H) Do Set "SizeHDD=%%I"
Resolved issue.
Re: HDD size
Code: Select all
Wmic VOLUME GET freespace, capacity, serialnumber
/webm/ should very much not be there.) Do For /F "EOL=S" %%H In ('%SystemRoot%\System32\wbem\WMIC.exe DiskDrive Where
i once decrypted memtest.exe and found webm & webp tags itself all over ram sectors... same for bootconfig, it also clones desktop.ini
to test it, remove the power, bios batters, ram and hdd's and networkcards from your computer and let sit well out at the grocery store or something. i bet you your pc will run like a charm when u reassemble and boot up again (dont put you net-cards back in right away). i have a suspicion that webm/webp is imprinting a trojen client which is sectioning off ram and hdd space as i am "missing" 7 gigs of hd and 10megs of memory and i believe it to be the hijacker of my website and facebook page.
is the proper wmic:
C:\Windows\WinSxS\x86_microsoft-windows-w..ommand-line-utility_31bf3856ad364e35_10.0.17763.1_none_365123c06ca2ece1\wmic.exe
Re: HDD size
Completely wrong! Once more! And - Do you really propose people to disassemble their PCs and remove their Bios battery?is the proper wmic:
C:\Windows\WinSxS\x86_microsoft-windows-w..ommand-line-utility_31bf3856ad364e35_10.0.17763.1_none_365123c06ca2ece1\wmic.exe
Earn a four-week vacation from the forum for potentionally lead forum users to damage their system, if not their hardware.
Steffen