Hello there,
The following script can be used in PowerShell to get the Serial Number for either the physical or virtualized host:
Get the list of all available drives
$d = (Get-PSDrive).Name -match '^[a-z]$'
For each of the drivers, extract the serial number
get-partition -DriveLetter $i | get-disk
Complete working code
$d = (Get-PSDrive).Name -match '^[a-z]$'
Foreach ($i in $d)
{
Write-Host $i". " -nonewline
get-partition -DriveLetter $i | get-disk
}
Similar discussion here https://social.technet.microsoft.com/Forums/office/en-US/5b4a7b5b-b1e1-4296-a8c4-762bd2eeef83/powershell-script-to-get-disk-uniqueid-and-drive-letter?forum=winserverpowershell
Hope this resolves your Query !!
--If the reply is helpful, please Upvote and Accept it as an answer–