Change SharePoint server hostname and Web Application Names
Note:I realize that many admins are reluctant to delete web applications. I personally know why I ma doing it and how to achieve this easily. You should always retain any customization you have added to the site, like web.config mods, etc. The Alternate Access Mappings are always available, but they leave open holes that I do not wish to keep active. I like a clean setup.
Why?Perhaps you need to clone a development, test, or some SharePoint server and you need to change the hostname so that it can exist on the same domain without a SID conflict. Or you just have a use-case for wanting to rename the hostname of a SharePoint server. It can be done, just make sure you go through all of the steps.
The Rename-SPServer PowerShell command can also be used to change the SQL Server name, for the case where you might move the databases to a new SQL server or instance and you need to point all of the farm servers to this new hostname\instance.
Changing the hostname isn't that bad, but it isn't enough as the web applications will revert back to the old name which is recorded in the configuration database and rests after a reboot.
Changing server hostname:
- Run the following command "Rename-SPServer" (Do not change the server hostname until after you run this command, or the farm will be unavailable until to revert the server back to its original name and rerun this command first)
- Rename-SPServer –Identity "wfb1" –Name "WFE1" Technet Rename-SPServer
- Change the server hostname. Then restart.
Changing Web Application URLs:
- Login to Central Admin.
- Navigate to Application Management -> Manage Web Applications
- For every site that is referencing the old server hostname in its URL, we will need to un-extend the web application from IIS.
- Note: You must do something special for the Central Admin site itself so I suggest you do this one last, as you will lost the ability to use Central Admin once you un-extend it. (This requires PowerShell to extend it and get it back).
- Click on the web application. Click the Delete drop-down menu in the Contribute section in the ribbon at top.
- Choose "Remove SharePoint from IIS web site" (This will remove the default zone for this web application so that you can go through the initial steps to provision the default site. You may show two sites because of multiple zones, you may want to un-extend all of them, you just need to think through what you are doing)
- A window pops up. Select the zone you wish to un-extend, it my case I needed to remove the default zone. Delete IIS web sites = NO. Click OK.
- In the same ribbon menu at top, click on Extend. Go through the same motions you would to first create that default zone, except this time ensure the new hostname of the server is used in the URL.
- Repeat for all web applications until you are ready to do the Central Admin site.
- For Central Admin: Repeat the same steps for un-extending the web application as you did for the others (there should only be one zone, Default).
- Now the Central Admin site is unusable, because you just removed the only zone you had to reference it. Now we need to open PowerShell, either open the SharePoint Management Shell or run PowerShell ISE, just make sure that you open it "Run as Administrator" or the command will fail.
- If using straight PowerShell add the SharePoint Snapin:
- Add-PsSnapin Microsoft.SharePoint.PowerShell
- Run this command to extend the web application for Central Admin and get your GUI interface back (Change the names to suit your environment, it should be obvious what to change):
- Get-SPWebApplication -Identity http://spdev1:3333 | New-SPWebApplicationExtension –Name "Central Administration 3333" -HostHeader "" -Port 3333 -Zone "Default" -URL http://we_sharepoint
You may want to change your central admin website to utilize SSL. The above steps are very similar to how you would accomplish that. Just make sure your DNS and SSL certificates are squared away or you will not have a Central Admin interface until you can route to the SSL site. But you now know how to use PowerShell to get the Central Admin site back if it doesn't work the first time.