PS
Powershell Tutorial Online

Powershell-Parameters



Script Parameters / Arguments (for scripts, functions and script blocks) To pass arguments to a script or cmdlet type them separated by spaces:

You just have to know how to declare your parameters.


Scenario 1:

Param(
[string]$computerName,
[int]$Number
)
    

Scenario 2: I could use the parameters like this:

Get-Something –computerName SERVER1 –filePath C:\Whatever
    

You can do the parameter validation using PowerShell.


ValidateNotNull only checks to see if the value being passed to the parameter is a null value. Empty string is still valid.
ValidateNotNullorEmpty This also checks to see if the value being passed is a null value and if it is an empty string or collection


    Function TestingMethod {
    [cmdletbinding()]
    Param(
        [parameter(ValueFromPipeline)]
        [ValidateNotNull()] #No value
        $Item )
    Process {
                $Item
            }
    }