Excuse my very limited knowledge of PowerShell commands but I basically want to get a service status report for all my servers. I know how to does this using a static list from a CSV file but ideally I would like to get it Dynamically each time.
I was looking at capturing this list to $servers as below:
$servers = Get-ADComputer -Filter {OperatingSystem -like "windowsserver"} -Properties * | sort Name | ft Name -Wrap -Auto*
This works and produces the output ok but I want to follow this up with something like this but i cant seem to get the $servers working for this command?
Get-Service -Computername $servers -Name wuauserv | Select-Object MachineName,Name,Displayname,Status | Sort-Object Status
Any help would be appreciated, thanks.