Hello,
If you used the script exactly as it is in the tutorial, then it works as designed and it should allow an Employee ID with an "-" character. On the contrary, it should not allow creating a user if the Employee ID does not contain the "-" character. Take a closer look at the following lines in the code:
if (**-not**($value.Contains("-")))
{
$Context.Cancel("employeeID is invalid.")
return;
}