http://www.sqlservercentral.com/blogs/powersql-by-prashanth-jayaram/2013/04/15/powershell-find-disk-drive-details-of-local-or-remote-server/

Printed 2014/04/23 08:05AM

PowerShell – Find Disk Drive Details of local or remote Server

By Prashanth Jayaram, 2013/04/15

Name of the Function : Get-DiskDriveDetails

Input Parameter : ServerName

Ouptut : Grid view, you can sort and force condition on specific output column

Function call : Get-DiskDriveDetails HQDB001

In this case HQDB001 is Name of the Server

Code:

Function Get-DiskDriveDetails([String]$server)
{
Get-WMIObject Win32_LogicalDisk -filter “DriveType=3″ -computer $server| Select SystemName,DeviceID,VolumeName,@{Name=”Size(GB)”;Expression={[decimal](“{0:N3}” -f($_.size/1gb))}},@{Name=”Free Space(GB)”;Expression={[decimal](“{0:N1}” -f($_.freespace/1gb))}}|out-gridview
}



Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.