SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Recently Changed Pages:

View All Pages


View All Tags


LinkedIn




WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Pages with comments

View All Comments

outgridview

PowerShell: Use Out-GridView To Select Value for Variable

Out-GridView allows you to interact with the output from a get commandlet. For example, say you want to select a server from Active Directory and put it in a variable but you can't quite remember the name.
Use the following command to display all AD computers, allowing you to select a server to put it in the variable:

$server = Get-ADComputer -Filter * | Out-GridView -PassThru -Title "Select server:"
Note the importance of the passthru option. If you don't set it, there won't be an option to actually select the server you need, it will just display all the AD computers.
You could leave a comment if you were logged in.
outgridview.txt · Last modified: 2021/09/24 00:25 (external edit)