A Referral Was Returned From The Server Powershell !full! Site
# 2. If not found locally, search the Global Catalog (contains all domains) # We search specifically for the ObjectSid to determine the domain. Write-Verbose "Searching Global Catalog for '$Identity'..." $gcSearcher = [adsisearcher]"(&(objectClass=user)(sAMAccountName=$Identity))" $gcSearcher.SearchRoot = [adsi]"GC://$($env:USERDNSDOMAIN)" $gcResult = $gcSearcher.FindOne()
The error in PowerShell typically indicates that the command was sent to a server (like a Domain Controller) that knows the information exists but cannot fulfill the request itself . It most commonly occurs during Active Directory (AD) operations when a script attempts to interact with an object in a different domain or a Global Catalog is needed but not used. Primary Causes in Active Directory
.PARAMETER Identity The SamAccountName, SID, or DistinguishedName of the object. a referral was returned from the server powershell
: A local security policy may require all elevated applications to be signed. If PowerShell tries to launch an unsigned executable or script with admin rights, Windows blocks it with this error. How to Fix "A Referral Was Returned From the Server" 1. Specify the Target Server or Global Catalog
# Helper to parse Domain from DN (e.g., DC=contoso,DC=com -> contoso.com) $domainParts = ($dn -split ',').Where({$_ -like 'DC=*'}) -replace 'DC=','' $targetDomain = $domainParts -join '.' It most commonly occurs during Active Directory (AD)
: Standard LDAP queries (port 389) do not follow referrals automatically; queries across a forest often require the Global Catalog port (3268) .
: Running cmdlets like Get-ADUser or Set-ADUser against an object located in a different domain or forest without specifying the correct server or port. If PowerShell tries to launch an unsigned executable
if (-not $gcResult) { Write-Warning "Object '$Identity' not found in Global Catalog." return $null }