Friday, December 18, 2015

Validating Input Parameters in PowerShell

If you need to validate Input Parameters in PowerShell for your PowerShell scripts, you will definitely want to take a look at these articles which provide useful insight on how to specify a set of validation attributes you can provide for your PowerShell Input Parameters:

http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/15/simplify-your-powershell-script-with-parameter-validation.aspx

http://learn-powershell.net/2014/02/04/using-powershell-parameter-validation-to-make-your-day-easier/

https://technet.microsoft.com/en-us/library/dd878347%28v=vs.85%29.aspx

In my case, I needed to validate my PowerShell Input Parameters using ValidateSet, but you can use any number of these validation attributes to validate input in your own PowerShell scripts!

No comments:

Post a Comment