param( [parameter( ValueFromRemainingArguments = $true )] [string[]]$Args # Leave all argument validation to the script, not to PowerShell ) ######## # Help # ######## if ( ( $Args.Length -gt 0 ) -or ( $HOME[0] -eq '/' ) ) { Clear-Host Write-Host if ( $HOME[0] -eq '/' ) { # Linux Write-Host "Disks.ps1 is for Windows only" Write-Host } Write-Host "Disks.ps1, Version 1.00" Write-Host "List physical harddisks and their manufacturer, model, size, bus type, physical location and more" Write-Host Write-Host "Usage: " -NoNewline Write-Host "powershell . Disks.ps1" -ForegroundColor White Write-Host Write-Host "Notes: This script does " -NoNewline Write-Host "not" -NoNewline -ForegroundColor White Write-Host " require elevated privileges." Write-Host Write-Host "Credits: Sorting by device ID based on tip by Frode F" Write-Host " https://stackoverflow.com/a/15040557" -ForegroundColor DarkGray Write-Host Write-Host Write-Host "Written by Rob van der Woude" Write-Host "http://www.robvanderwoude.com" Write-Host exit 1 } Get-PhysicalDisk | Select BusType,DeviceID,FirmwareVersion,Manufacturer,MediaType,Model,PhysicalLocation,SerialNumber,Size | Sort-Object { [int]$_.DeviceID }