2
Powershell beginner here. I want to run a command in the terminal to list all the domain members of the specified domain with select properties, sorted by name. I have a domain with just under 400 PCs. I pieced together some stuff from online guides. The command I wrote is:
$props = @('Name', 'OperatingSystem', 'OperatingSystemVersion', 'IPv4Address'); Get-ADComputer -Filter * -Property $props -SearchBase "DC=domainname,DC=com" -Server "domainname.com" -Credential "domainname.com\domainuser" | Sort-Object -Property Name | Format-Table $props -Wrap –Auto
Sorting by name is a convenience; I don't absolutely need it but it would be nice. The above query gets the expected results but it takes quite a long time. With the sorting step it takes about 20 seconds to output the results. Without the sorting it takes about 1 second.
Is there any more efficient way to sort the output?