I wanted to ask as I'm querying all users from AD whose Home Directory is in a certain directory from Powershell using Get-ADuser , and for most cases it retrieves null result.
The query I run is this:
$DirectoryInfo = Get-Item \\Fileserver\Users
$strFilter = $DirectoryInfo.FullName.Replace('\','\5c')
$AdUser = Get-AdUser -Filter {homeDirectory -like $strFilter}
echo $AdUser
If I look from AD admin center panel for a specific user, I can see it has set Home Directory inside path i've queried before in Powershell indeed.
Another thing that seems to me strange is that there are some users that appear in the query, so the previous case doesn't apply for all users.
Is it that AD admin center panel shows Home Directory of Group where this user belongs for example, or is just that I'm running a wrong query from Powershell?
Thanks in advance,
Juan Pablo.