Powershell - Out-GridView and his parameters

To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker or make a donation. Thank you!

Hello,

Out-GridView is used to display a result in the form of an interactive table offering object filtering and sorting functionalities.

You can directly in filter, select a filter column: column_name:value.

You can also arrange the order of the columns (drag & drop the column title) and hide them (right-click on a column title > select columns).

Out-GridView supports up to 30 properties.

# Example :
Get-Process | Out-GridView
# In filter, test: processname:svchost
# Specify the properties to display
Get-Process | Select-Object name, id, path | Out-GridView

Out-GridView’s -PassThru argument allows interesting options such as exporting selected items or performing actions on selected items.

# Export selected result to CSV:
Get-Process | Out-GridView -PassThru | Export-CSV -Path C:\Process.csv
# Export the selected result to the clipboard (clip.exe):
Get-Process | Out-GridView -PassThru | Clip
# Create a selection menu to perform actions on the selected elements
Get-Process | Out-GridView -PassThru -Title 'Choose processes to stop'| Stop-Process -WhatIf
# By default -Passthru allows multiple selection, but you can limit it to a single selection
1..10 | Out-GridView -Title 'Select an item' -OutputMode Single

The Out-GridView help presents the -Wait argument, allowing it to be integrated into a shortcut.

# In a Powershell shell, test the following syntaxes:
powershell -Command "Get-Service | Out-GridView -Wait"
powershell -Command "Get-Service | Out-GridView"

Related links