Controller script

I watched and enjoyed Don’s 3 videos on toolmaking. Don refers to a ‘controller script’. Would this be a script that calls a bunch of functions ?

It would be indeed.

Awesome, thanks Don !

any good examples out there in the wild to reference. I know there are bunch of different ways to collect inputs and start calling functions just curious to see preferences/examples of how MVPs like yourself do it.

Yeah, me too. It’s a clear way forward, but I’m not sure how to go about it…

dont think i have came across those vids, could you share a link(s)

Don Jones Toolmaking Part 1/3

thanks Olaf


I’m not saying this is the BEST way of doing it, but it works, and seems reasonably elegant to me (with much credit to members of the Powershell forum in the Spiceworks community, particularly tfl):

    $FirstName = .\Get-UserFirstName.ps1
} Until ($FirstName)

    $LastName = .\Get-UserLastName.ps1
} Until ($LastName)

$Title="Enter Telephone Extension Number"
    $Extension = .\Get-UserExtension.ps1 -verbose -Title $Title
} Until ($Extension)

Write-Output "Child scriptS gave me '$FirstName' and '$LastName', and extension number '$Extension'"

And here’s the first script, Get-UserFirstName.ps1:

Function Get-UserFirstName
$FirstName = Read-Host -Prompt "First Name"

return $FirstName