0

I want to use Get-PhysicalDisk | select MediaType to find SSD drives.

Like the question said, fails on Server 2012 R2.

Also tried using VBScript WMI:

On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMedia",,48)
For Each objItem in colItems
    MsgBox "MediaType: " & objItem.MediaType
Next

No joy.

3
  • Try Get-WmiObject Win32_DiskDrive | Where-Object { $_.model -match "SSD" }. – harrymc Aug 3 '19 at 15:24
  • The code returns nothing at all on Server 2012 R2 - no error, either. On Windows 10 1903 get this: Cannot run a document in the middle of a pipeline: C:\WINDOWS\system32\Get-WmiObject....CantActivateDocumentInPipeline – SKidd Aug 5 '19 at 11:16
  • What adapter is the drive attached to? A google search shows related problems with raid(capable) controllers. – LotPings Aug 5 '19 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.