I would like to have an array that contains a set of functions that I can iterate through and call. The issue is that the functions all run via the line that adds them to the array (ie. $scripts).
Example:
function Hello
{
$BadFunction = "Hello"
Write-Host "Hello!"
}
function HowAreYou
{
$BadFunction = "HowAreYou"
Write-Host "How are you?"
#$false = $true
}
function Goodbye
{
$BadFunction = "Goodbye"
Write-Host "Goodbye!"
}
$scripts = @((Hello), (HowAreYou), (Goodbye))
foreach ($script in $scripts)
{
$script
}