powershell get parameters of function code example
Example 1: parameter powershell
Param (
[Parameter(Mandatory=$True, Position=1)]
[string]$String,
[Parameter(Mandatory=$True)]
[int]$Int,
[switch]$Switch = $false
)
Example 2: powershell get arguments
param (
[string]$server = "http://defaultserver",
[Parameter(Mandatory=$true)][string]$username,
[string]$password = $( Read-Host "Input password, please" )
)