Skip to content

Instantly share code, notes, and snippets.

@IAmStoxe
Last active April 15, 2020 00:54
Show Gist options
  • Select an option

  • Save IAmStoxe/b3ed9b9ebb131838d5922dd1e393f764 to your computer and use it in GitHub Desktop.

Select an option

Save IAmStoxe/b3ed9b9ebb131838d5922dd1e393f764 to your computer and use it in GitHub Desktop.
List Hard Disk Information on Remote Computers within a Domain
$creds = Get-Credential
$serverListPath = "C:\tmp\PhysicalHosts.txt"
Get-WmiObject win32_diskdrive -Credential $creds -Computer (Get-Content $serverListPath) |
Where-Object MediaType -eq 'Fixed hard disk media' |
Select-Object SystemName, Model, @{Name = 'Size(GB)'; Exp = { $_.Size / 1gb -as [int] } } |
Export-CSV "C:\tmp\disks.csv"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment