Find serial numbers on slaved HDDs with Powershell

musik7

New member
Local time
10:43 AM
Messages
10
For starters, a little background. I am in the IT dept at my company, and we have a large number of HDD's that we need to archive. I have a powershell script that will grab hostname and username info from the drives, but I would like to grab the serial numbers as well if I can.

Here's what I currently have that will grab the serial number info:

$Disks = Get-WMIObject -class win32_PhysicalMedia
foreach($Disk in $Disks) {Write-Host $Disk.SerialNumber}

Ok, here's my question:
This portion of the script works just fine, but it seems that the serial number field that stores this information is blank unless the PC was booted up with the HDD connected internally. I have close to 200-300 HDD's that I need to go through and we usually get a couple more every day, so it's not very feasible to reboot the computer for each drive (as opposed to using a USB HDD dock). Does anyone know if it's possible to have the computer re-scan the disks, or some other action that will cause this serial number field to populate, or will it only be populated when the drive is installed internally from boot-up?

Thanks in advance for the help.
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Enterprise 64 bit
I'm not a cmd line person but you could try these two 3rd party program install on the mother computer. Then just plug in the usb drive and run the program.
On my systems their is no reboot needed. Just plug them in the usb and run one of the programs.

Speccy
Belarc

Belarc Advisor - Free Personal PC Audit, for software, hardware and security configuration information on your computer. Software license management, IT asset management, cyber security audits, and more.

https://www.piriform.com/speccy

From Belarc

Drives 239.82 Gigabytes Usable Hard Drive Capacity
182.38 Gigabytes Hard Drive Free Space

CD-ROM Drive [Optical drive]

INTEL SSDSC2BP240G4 [Hard drive] (240.06 GB) -- drive 0, s/n BTJR443200ZV240AGN, rev L2010420, SMART Status: Healthy
Memorex TD Classic 003C USB Device [Hard drive] (2.05 GB) -- drive 1

-----------------------------------------------------------------------------

From Speccy

torage
Hard drives
Disk drive
Heads 16
Cylinders 29,185
Tracks 7,442,175
Sectors 468,857,025
SATA type SATA-III 6.0Gb/s
Device type Fixed
ATA Standard ATA8-ACS
Serial Number BTJR443200ZV240AGN
Firmware Version Number L2010420
LBA Size 48-bit LBA
Power On Count 327 times
Power On Time 50.3 days
Speed Not used (SSD Drive)
Features S.M.A.R.T., NCQ, TRIM, SSD
Max. Transfer Mode SATA III 6.0Gb/s
Used Transfer Mode SATA III 6.0Gb/s
Interface SATA
Capacity 223 GB
Real size 240,057,409,536 bytes
RAID Type None
S.M.A.R.T
Status Good
Temperature 21 °C
Temperature Range OK (less than 50 °C)
S.M.A.R.T attributes
Partition 0
Partition ID Disk #0, Partition #0
Size 100 MB
Partition 1
Partition ID Disk #0, Partition #1
Disk Letter C:
File System NTFS
Volume Serial Number 8A7DC2D0
Size 223 GB
Used Space 53 GB (23%)
Free Space 169 GB (77%)
Flash drives
Memorex TD Classic 003C USB Device
Interface USB
Capacity 1.91 GB
Real size 2,055,208,960 bytes
RAID Type None
S.M.A.R.T
S.M.A.R.T not supported
Partition 0
Partition ID Disk #1, Partition #0
Disk Letter E:
File System FAT
Volume Serial Number 60F0A925
Size 1.91 GB
Used Space 12.7 MB (0%)
Free Space 1.9 GB (100%)
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Home made Desktop
OS
Windows 10 Pro. 64/ version 1709 Windows 7 Pro/64
CPU
Intel i7-6800K @ 4.3
Motherboard
ASUS X-99 Deluxe II
Memory
Corsair Platinum 16 gig @2400
Graphics Card(s)
EVGA GTX 1070 OC
Monitor(s) Displays
Asus 27" LED LCD/VE278Q
Screen Resolution
1920-1080 or 1280-720 HDMI
Hard Drives
INTEL SSD 730-240 Gb Sata 3.0/
PSU
EVGA Platium 1200W
Case
Phanteks Luxe Tempered Glass 8 fans/ one radiator
Cooling
XSPC/ Water Cooled CPU
Keyboard
Das 4 Professional
Mouse
Logitech M705/MX Anywhere 2-S
Internet Speed
100 mbits
Antivirus
Microsoft Security Essentials/ Malwarebytes Premium 3.0/ SAS
Browser
I.E. 11 default/Firefox/ ISP Time Warner Cable/Spectrum
Other Info
LG BluRay Burner/
Sound system-KLipsch-THX/
Icy Dock ssd Hot Swap bays.
Thanks for the tip, I'll keep that in mind. Ultimately, I would like to see if I can make it work within powershell though, as my powershell script gathers all the info, and then automatically prints it, so ultimately all I will need to do for each drive is connect it, and push F5.
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Enterprise 64 bit
I don't know enough about Powershell to be giving any advice.
Just wait, someone will come along.
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Home made Desktop
OS
Windows 10 Pro. 64/ version 1709 Windows 7 Pro/64
CPU
Intel i7-6800K @ 4.3
Motherboard
ASUS X-99 Deluxe II
Memory
Corsair Platinum 16 gig @2400
Graphics Card(s)
EVGA GTX 1070 OC
Monitor(s) Displays
Asus 27" LED LCD/VE278Q
Screen Resolution
1920-1080 or 1280-720 HDMI
Hard Drives
INTEL SSD 730-240 Gb Sata 3.0/
PSU
EVGA Platium 1200W
Case
Phanteks Luxe Tempered Glass 8 fans/ one radiator
Cooling
XSPC/ Water Cooled CPU
Keyboard
Das 4 Professional
Mouse
Logitech M705/MX Anywhere 2-S
Internet Speed
100 mbits
Antivirus
Microsoft Security Essentials/ Malwarebytes Premium 3.0/ SAS
Browser
I.E. 11 default/Firefox/ ISP Time Warner Cable/Spectrum
Other Info
LG BluRay Burner/
Sound system-KLipsch-THX/
Icy Dock ssd Hot Swap bays.
I don't know powershell either but here's another tool that might help. (It can also be run from command line and output to tab delimited file so you can extract the data you seek)

Look at USBDeview freeware from Nirsoft to see serial numbers of USB connected disks. (Note the disks don't even need be still connected. Note the column header Connected tells you if the device is still connected or not)

Click on column header Device Type to sort and then the scroll down to look at the USB Mass Storage (This device type also includes CD/DVD drives so you may still need to further filter the results if you only want disk)

btw... What is the host name and user name of a hard drive???
 

Attachments

  • 2016-02-05_211147.jpg
    2016-02-05_211147.jpg
    259.5 KB · Views: 2

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell Optiplex 360 and Optiplex 755
OS
Desk 1: Win 7 Pro x32; Desk 2: Windows 10 x64
Hard Drives
500GB Crucial SSD in both Desktops
Other Info
Buffalo 6TB NAS, Raid 1
I don't know powershell either but here's another tool that might help. (It can also be run from command line and output to tab delimited file so you can extract the data you seek)

Look at USBDeview freeware from Nirsoft to see serial numbers of USB connected disks. (Note the disks don't even need be still connected. Note the column header Connected tells you if the device is still connected or not)

Click on column header Device Type to sort and then the scroll down to look at the USB Mass Storage (This device type also includes CD/DVD drives so you may still need to further filter the results if you only want disk)

btw... What is the host name and user name of a hard drive???

Thanks ComputerGeek, good info. I might look into USBDeview for it's command line options if I can't get it to work within powershell.

I'm basically just gathering what the hostname was for any drives with a windows OS on them, as well as the users listed in C:\Users (or Docs and settings for XP drives). There will be some drives that don't have a windows OS on them, so those won't follow my normal process.
 

My Computer My Computer

Computer type
PC/Desktop
OS
Windows 7 Enterprise 64 bit
Back
Top