PowerTip: Use PowerShell Grid View to Display Logon Info

Doctor Scripto

Summary: Learn how to display user logon information.

Hey, Scripting Guy! Question How can I use Windows PowerShell to display user logon information in an easy graphical manner?

Hey, Scripting Guy! Answer Create two hash tables using environmental variables, and pipe the input to the Out-Gridview cmdlet,
           for example:

@{"username" = $env:USERNAME}, @{"Computername"=$env:COMPUTERNAME} |
Out-GridView -Title "user logon info"

Note This is a single-line command broken at the pipeline character for display on the blog.


Discussion is closed.

Feedback usabilla icon