Try question in the powershell forums where the powershell experts are.
https://social.technet.microsoft.com/Forums/win...
Hope this helps and good luck!
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
First off, sorry for the category this is in... I honestly have no idea what category "Powershell help" should go under.
I was messing around with Powershell and trying to learn it (I'm pretty dang new to it, but I'm learning) and my issue comes into play when I try to use two functions, AND check for user input.
Aka:
Function > Call a function
Called function > Check if there's user input, if there is, then just output it. If there isn't user input, then prompt for it.
It works perfectly as expected when I just use the single function, yet when I try to add another leading into it (it's required for my goal), it screws up and goes wrong.
By the way, I'd be typing these two things, with the expected result after:
Get-Run
(Expecting a prompt for "Please enter an age.", then that answer outputted after.
Get-Run -Age 4
(Expecting it to save the age of 4, then outputting it after.)
Of course, I could have it do it in the first function, but that won't work for what I want to do. I need all of this in the second section, if at all possible. If not, then oh well.
Clear-Host
Function Get-Age {
Param(
[Parameter(Mandatory = $true, HelpMessage="Please enter an age.")]
[ValidateNotNullorEmpty()]
[int] $Age
)
$Age
}
Function Get-Run {
Param (
)
Get-Age
}
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Try question in the powershell forums where the powershell experts are.
https://social.technet.microsoft.com/Forums/win...
Hope this helps and good luck!
Welp, wrong place! That explains why the category was so confusing to me...
Thanks of course!