The attached script (Check-ADGroupsExist.ps1.txt) I just finished and it would be great to get some feedback on it.
Also, I was told by someone at work that if I use the Mandatory=$true, then there is no need to use the [ValidateNotNullorEmpty()]. I always thought that Mandatory just makes the parameter mandatory. Just because a parameter is mandatory does not mean that it has to contain a value, right? This is why the need to use the [ValidateNotNullorEmpty()], correct, or am I off my rocker?
Does the use of Mandatory=$true tell PowerShell that the parameter MUST be used and that the parameter also MUST have a value?
If this is the case, then why do I keep seeing both used all the time as in the example below:
[Parameter(Position=0,Mandatory=$True,HelpMessage=“Enter a process name like lsass”)]