Just another note that if you only need the Name property, you will have some better performance just getting the required properties.
Get-ADComputer -Filter Name | Select-Object Name | .\servicecheck.ps1 -servicename bits
Just another note that if you only need the Name property, you will have some better performance just getting the required properties.
Get-ADComputer -Filter Name | Select-Object Name | .\servicecheck.ps1 -servicename bits