• Depending on the size of your environment, you can significantly reduce the time required to get the list of servers in 2 ways.  First, don't use -Properties * with the Get-ADComputer command.  I'm guessing you're doing that to return the OperatingSystem property, which you're using in your Where statement (which is not necessary).  If all you need is that one property, just use -Properties 'OperatingSystem' instead.  A better option (which will further reduce the run-time) is to use the -Filter parameter that is already built into the cmdlet.  Get-ADComputer -Filter {OperatingSystem -Like '*Server*'} will return the same results, but do it in a fraction of the time.  Alternatively, you could do Get-ADComputer -LDAPFilter '(OperatingSystem=*Server*)'