PowerShell 7.3 - Difficulty Retrieving User Properties from AD with Get-ADUser and Filters
I'm working on a personal project and I'm building a feature where I'm following best practices but I'm trying to retrieve specific properties of users from Active Directory using the `Get-ADUser` cmdlet in PowerShell 7.3. However, when I apply a filter to get users based on their 'Department', I keep running into an scenario where the properties I need do not seem to be returned correctly. For example, this command: ```powershell Get-ADUser -Filter "Department -eq 'Sales'" -Property DisplayName, EmailAddress ``` works fine in earlier versions, but it seems to return empty results in 7.3 despite users existing in that department. I also tried using `Where-Object` as a workaround: ```powershell Get-ADUser -Filter * | Where-Object { $_.Department -eq 'Sales' } | Select-Object DisplayName, EmailAddress ``` This approach returns an behavior: `Property 'Department' want to be found on this object`. I've verified that the `Department` attribute is populated in Active Directory. I've also experimented with retrieving all properties to see if the attribute is being missed: ```powershell Get-ADUser -Filter "Department -eq 'Sales'" -Properties * ``` This still yields the same empty result. I double-checked my permissions, and I have the necessary access to read user attributes. Could there be a compatibility scenario with how PowerShell 7.3 interfaces with Active Directory, or is there something specific I need to adjust to retrieve these user properties correctly? Any insights would be greatly appreciated! I'm working on a web app that needs to handle this. What's the best practice here? The stack includes Powershell and several other technologies. I'm open to any suggestions. I'd be grateful for any help. For reference, this is a production REST API.