Sep 9, 2013 at 7:35 AM
Edited Sep 9, 2013 at 11:22 AM
Hi Kendal,

I have started understanding the code you have written and implement in our environment, I am novice at PowerShell.. can you please explain about the code in ValidatePattern?
  1. (?:(?:
  2. ^
  3. | - I know this pipe acts as a where in PowerShell, how about here?
  4. ?).
  5. automatic$ - if anything starts with $, it is variable, what if ends with $?
Thanks for sharing this wonderful thing to all of us.
Sep 12, 2013 at 8:50 PM
Hi RD,
If you look closely you'll notice that the entire string in ValidatePattern() is surrounded by single quotes - that makes it a literal string...specifically, it's a regular expression for validating that either an IP address or the words "auto" or "automatic" were passed as a value for that parameter.

You can read more about how ValidatePattern works at http://technet.microsoft.com/en-us/library/hh847743.aspx and http://powershell.com/cs/blogs/tips/archive/2013/07/19/using-validatepattern-attribute.aspx

Hope this helps!