I am trying to learn pester by writing tests for an existing function I have. I want to change some of the functionality and need to make sure that I don't break anything, so adding some pester tests before modifying the function seemed like a good idea.
This section of the script has some try catches, the script is supposed to accept either a sid or a domain\username, and return the sid, it works when running the function by itself. The errors catch properly and everything:
Powershell
If($UserID){$sids=ForEach($itemin$UserID){Try{#If the value submitted isn't a valid sid, it'll error.$sid=[System.Security.Principal.SecurityIdentifier]($item)#line possible not needed:#$sid = $sid.Translate([System.Security.Principal.SecurityIdentifier])}Catch[System.Management.Automation.RuntimeException]{# If a RuntimeException...