Microsoft PowerShell Basics
When you just want to quickly locate a volume or group of volumes by the name or even part of the name as well as the associated size quickly, this post will get you there.
Example:
Get-NCVol
Get a list of all volumes and filter on volume name
Example:
Get-NcVol | where { $_.Name -like ‘*test*’}
Get a list of all volumes and filter on volume name and filter out everything except the volume name and size
Example:
Get-NcVol | where { $_.Name -like ‘*test*’} | FT name,TotalSize
To get the final number expressed in GB
Example:
Get-NcVol | where { $_.Name -like ‘*test*’} | FT name,TotalSize, {$_.TotalSize /1GB}
Export to excel
Example:
Get-NcVol | where { $_.Name -like ‘*test*’} | Out-File C:\Users\knowledge\Desktop\Powershell\test.csv