title: Using a global catalog in PowerShell
body: <p>I have multiple domains in my forest, and I'm trying to write a script that will work with any user in the forest, so I'm using a global catalog in my script.  </p>
  
  <p>This works to retrieve the data, but when I try and modify the data I'm getting</p>
  
  <blockquote>
    <p>Set-ADUser : The server is unwilling to process the request</p>
  </blockquote>
  
  <p>If I use the domain controller (DC) as the server name, the modification completes as it should. I'd like to avoid writing a switch to set the server name. Is there anything else I can do here?</p>
  
  <pre><code>Get-ADUser $user -Server "contoso.local:3268" | %{Set-ADUser -Identity $_.distinguishedname -SamAccountName $_.SamAccountName -Server "contoso.local:3268"}
  </code></pre>