Reputation: 23
function User-Search($input)
{
Write-Host "Searching for user: $input"
pause
}
function Show-Menu
{
param (
[string]$Title = 'MainMenu'
)
cls
Write-Host "================ $Title ================"
Write-Host " "
Write-Host "Specify computer / username"
Write-Host " "
Write-Host "Q: Press 'Q' to quit."
Write-Host " "
}
do
{
Show-Menu
$input = Read-Host "Search"
User-Search -input $input
}
until ($input -eq 'q')
Outputs: "Searching for user:", it's empty.
There must be some small mistake i am doing, probably easy for you guys :)
Upvotes: 1
Views: 35
Reputation: 58931
$INPUT
is an automatic variable:
Contains an enumerator that enumerates all input that is passed to a function. The $input variable is available only to functions and script blocks (which are unnamed functions).
So just use another variable, e. g. $user
instead of $input
Upvotes: 3