Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 17778

PowerTip: List Physical Drives with PowerShell

$
0
0

Summary: Use Windows PowerShell to list physical drives.

Hey, Scripting Guy! Question How can I use Windows PowerShell to get a list of physical drives?

Hey, Scripting Guy! Answer Use Get-WMIObject, query win32_logicaldisk, and filter with the DriveType property:

GET-WMIOBJECT –query “SELECT * from win32_logicaldisk where DriveType = ‘3’”

To check the drives on a remote computer, add the –ComputerName parameter.
For example, to list all physical drives and their free space on a machine called “ContosoWS1”:

GET-WMIOBJECT –query “SELECT * from win32_logicaldisk where DriveType = ‘3’”
–computername “ContosoWS1”


Viewing all articles
Browse latest Browse all 17778

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>