Here’s another quick oneliner I had to create for someone today and wanted to share with you:
Get-QADComputer -ComputerRole member -SizeLimit 0 -OSName 'Windows XP*', 'Windows 2000 Professional', 'Windows 7*', 'Windows Vista*'
The initial one-liner the customer was using was retrieving all
Member computers but then using Where to filter by
$_.operatingsystem whatever did not have
Server in the name. This took longer (because Where is filtering on the client side after all objects are already retrieved) and resulted in extra computers being reported such as non-Windows storage systems.
Using cmdlet parameters makes sure that filtering is done during the object retrieval which is more efficient. And, as you can see,
OSName parameter – as most parameters in QAD cmdlets – supports multiple values.
Depending on your environment you might want to modify the OS list to include Windows 8 or Mac OS😉
If you want to get full list of operating systems in use in your company you would probably execute something like:
Get-QADComputer -SizeLimit 0 | group operatingsystem | sort Count -Descending
Hope this helps!