Determining the Serial Number of a Disk Drive with PowerShell
If you need to determine the serial number of a hard disk drive (HDD)
attached to a Microsoft Windows system, you can do so from a
PowerShell
window using the cmdlet Get-Disk (you can open a
PowerShell window by typing PowerShell
in the Windows "Type here to
search field on a Windows 10 system and then selecting the app when it is
returned in the list of search results). If you just want a list of drives
attached to the system by a USB
connection, you can pipe
the output of the cmdlet to the
Where-Object cmdlet where you can filter on just drives that have a USB
connection as shown below.
PS C:\> Get-Disk | Where-Object -FilterScript {$_.Bustype -Eq "USB"}
Number Friendly Name Serial Number HealthStatus OperationalStatus Total Size Partition
Style
------ ------------- ------------- ------------ ----------------- ---------- ----------
1 SanDisk Cr... 03025228050421082418 Healthy No Media 0 B RAW
2 USB2.0 Car... 606569746800 Healthy No Media 0 B RAW
4 USB2.0 Car... 606569746802 Healthy No Media 0 B RAW
5 USB2.0 Car... 606569746803 Healthy No Media 0 B RAW
3 USB2.0 Car... 606569746801 Healthy No Media 0 B RAW
6 WD My Pass... WXM1A375CKEZ Healthy Online 931.48 GB GPT
PS C:\>
[ More Info ]
[/os/windows/PowerShell]
permanent link
Filtering Windows Updates by a Specific Date
When I logged into a user's Microsoft Windows 10 system to check on a problem,
I found the system had rebooted late the night before, September 12, 2003, at
a time much later than I would expect the user to be working, so I didn't think
she had rebooted it. I didn't know if the reboot might be related to the
problem she reported to me or could possibly just be Microsoft Windows
rebooting because of an automatically installed update. From a
command prompt window, you can
obtain the last time the system was rebooted using the
systeminfo
command. To see just the last reboot time and not all of the other output
it provides, you can filter the output with the
find command
by
piping the output of the
systeminfo
command to the
find
command. You can check on updates that have been
installed using the
Windows Management Instrumentation Command-line (WMIC) command
wmic qfe list
("qfe" stands for "Quick Fix Engineering").
Since that command can also generate a lot of output for updates on dates
you may not be interested in, you can also filter that output
with the
find
command.
[ More Info
]
[/os/windows/PowerShell]
permanent link