Answer the question
In order to leave comments, you need to log in
Displaying results inside a function?
function TestFunc1() {
Get-NetAdapter
#return $null
}
function TestFunc2() {
$ret2 = TestFunc1
}
TestFunc2
Answer the question
In order to leave comments, you need to log in
Something is not clear why you need such pasta, but you can get the output on the screen through Out-Host:
Get-NetAdapter | Out-Host
TestFunc2 does not display anything because it only assigns $ret2, and this operation does not display anything on the screen.
If you want the result to be visible, then you need to "show" the contents of the variable:
function TestFunc2() {
$ret2 = TestFunc1
$ret2
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question