Good evening all!
I have a database and two functions.
In the database, I have a table that holds all log entries from PS scripts I run and tie in logging. Typically, that table’s record will have an entry like this:
TimeStamp | ScriptName | Action | Result | Notes | System (for computer touched by the script).
I have a function created that will list for me all scripts listed in that table that have run in the last month. It’s basically called, “FUNCTION List-LoggedScripts”. If I run this script, I’ll get a result like:
ScriptName
New-NICSetting
Find-UserDetails
Find-MissingSystems
Those results, above, are the scripts, again, that have been run in the last month.
I have a second function that will allow me to pull the logs from the last run of a script. This script is called “Get-LatestLogs”. It’s structured something like this:
FUNCTION Get-LatestLogs ($scriptName){ CODE FOR GOING AND GETTING LATEST LOG ENTRIES FROM }
Instead of typing in a $scriptName answer explicitly, I’ll like to be able to pikc from the results of the first function List-LoggedScripts at the time that I run the command, seeing the options from a drop down when I type:
Get-LatestLogs -scriptName DROPDOWNHERE
I have Googled to no avail. I see where you can add an array, but not create an array from a function and add it on the fly.
Possible? Help?
Thanks for anything ya’ll can offer.
Mark