Not too long ago I posted a PowerShell function that could provide detail abut the PowerShell engine driving your current PowerShell session. I like having a function that writes an object to the pipeline, can take parameters and offer help documentation. But there’s an alternative approach you could also take.
Most of the information is already in $PSVersiontable. So why not use that as a vehicle? This variable is a simple hashtable that is constructed every time you start a PowerShell session. This means you can add key/value pairs to it with the Add() method.
$PSVersionTable.add("Path",(Get-Process -id $pid).Path)
Remember that this will only change the variable for the current PowerShell session. If you wanted to always have this extended information, you would need to add these lines to your PowerShell profile script or create a simple function. If you go that route, you’ll want to include some testing and error handling because you can’t add a value that already exists. When you are done you get results like these:
$PSVersiontable is not an ordered hashtable so you can’t predict the display order, but it does offer a quick and dirty way to store additional information you might want to reference.