Hi Tevon,
To change the domain name in SharePoint Server 2019 using PowerShell, you can follow these steps:
- Download and install the latest SharePoint Server 2019 Management Shell.
- Connect to SharePoint Server 2019 as a farm administrator using the
Connect-SPFarm
cmdlet. - Use the
Set-SPAlternateURL
cmdlet to add the new URL for the web application. - Use the
Set-SPSiteURL
cmdlet to update the site collection URLs. - Use the
Move-SPUser
cmdlet to update the user accounts to use the new domain name.
Here is an example PowerShell script that you can use to change the domain name to RE-REK:
# Connect to SharePoint Server 2019 as a farm administrator
Connect-SPFarm -UserAccount "RE-REK\upsync"
# Add the new URL for the web application
Set-SPAlternateURL -Url "https://RE-REK.sharepoint.com" -Zone "Default"
# Update the site collection URLs
Get-SPSite -Limit All | ForEach-Object {Set-SPSiteUrl $_.Url -Zone "Default" -Url ("https://RE-REK.sharepoint.com" + $_.ServerRelativeUrl)}
# Update the user accounts to use the new domain name
Move-SPUser -Identity "OLD_DOMAIN\username" -NewAlias "RE-REK\username"
Note that this process may take several hours to complete depending on the number of sites and users that you have. It is recommended to perform this change during a period of low usage and to inform users to avoid accessing SharePoint content during the change. Additionally, any actions that create new sites or users will be temporarily blocked during the rename.
For your references:
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.