How to make a parameter mandatory in powershell.
Enter this at the start of your script.
param(
[Parameter(Mandatory=$true)]
[string]$Server
)
A very good explanation and additional ways to do it is here.
https://blogs.technet.microsoft.com/heyscriptingguy/2011/05/22/use-powershell-to-make-mandatory-parameters/
Enter this at the start of your script.
param(
[Parameter(Mandatory=$true)]
[string]$Server
)
A very good explanation and additional ways to do it is here.
https://blogs.technet.microsoft.com/heyscriptingguy/2011/05/22/use-powershell-to-make-mandatory-parameters/