When i ran it i received an error on the first cmdlet. Having looked at the examples in get-help i saw that he error is in how you passed the information to the filter parameter. I changed your code to this:
At a glance, I'm curious why they are checking to see if the count is greater than 2, but I can't test this right now. Perhaps you should review that script and try replacing your -eq 1 with -le 2 and see what results you get back.