Function in Powershell Script

Function in Powershell Script

Here is example of function return value in Powershell script


cls
 
Function Sum($ParamA, $ParamB)
{ 
 Write-Host "ParamA = " $ParamA
 Write-Host "ParamB = " + $ParamB
 $total = $ParamA + $ParamB
 Write-Host "Total = " $total
 return $total
} 

$returnValue = Sum -ParamA 10 -ParamB 15

Write-Host "return value = " $returnValue



 

Hope this will help you and save your time.

Enjoy !!!

:)

No comments:

Post a Comment