Skip to main content

A Referral Was Returned From The Server Powershell Jun 2026

In PowerShell, the error "A referral was returned from the server" typically occurs during Active Directory (AD) operations when the command is querying a Domain Controller (DC) that does not hold the requested data, but knows which other server does. Most standard AD cmdlets do not automatically follow these referrals, leading to this error. Stack Overflow +1 Common Causes & Solutions Querying the Wrong Domain

# 3. Extract the DistinguishedName to derive the target domain $dn = $gcResult.Properties['distinguishedname'][0] $domainContext = New-Object System.DirectoryServices.ActiveDirectory.DirectoryContext("Domain") a referral was returned from the server powershell

Based on the error message "A referral was returned from the server," which typically occurs in Active Directory environments when a query (like Get-ADUser or Get-ADGroupMember ) targets a different domain than the one the machine is currently joined to, a highly useful feature is a . In PowerShell, the error "A referral was returned

Finds the user 'jdoe' regardless of which child domain they reside in. #> Extract the DistinguishedName to derive the target domain

Write-Verbose "Object found in domain: $targetDomain. Retrieving directly..."

if (-not $gcResult) { Write-Warning "Object '$Identity' not found in Global Catalog." return $null }