Controller script

Welcome Forums General PowerShell Q&A Controller script

This topic contains 8 replies, has 6 voices, and was last updated by

 
Participant
1 year, 12 months ago.

  • Author
    Posts
  • #37981

    Participant
    Points: 0
    Rank: Member

    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 ?

  • #37982

    Keymaster
    Points: 1,624
    Helping HandTeam Member
    Rank: Community Hero

    It would be indeed.

  • #38001

    Participant
    Points: 0
    Rank: Member

    Awesome, thanks Don !

  • #39060

    Participant
    Points: 0
    Rank: Member

    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.

    • #57323

      Participant
      Points: 1
      Rank: Member

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

    • #57749

      Participant
      Points: 1
      Rank: Member

      Nick

      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):

      Do
      {
          $FirstName = .\Get-UserFirstName.ps1
      } Until ($FirstName)
      
      Do
      {
          $LastName = .\Get-UserLastName.ps1
      } Until ($LastName)
      
      $Title="Enter Telephone Extension Number"
      Do
      {
          $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
      }
      
      Get-UserFirstName
  • #57334

    Participant
    Points: 20
    Rank: Member

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

  • #57338

    Participant
    Points: 20
    Rank: Member

    thanks Olaf

The topic ‘Controller script’ is closed to new replies.