I took this from Mirjams blog. I have verified that it works. I am adding it here so that I can find it when I need it, and as I mentioned, it works great.
Renaming a WSS3 or MOSS server requires very specific tasks in a specific order. If you don’t follow the following instructions precisely, the chances are that you may need to reconfigure your whole MOSS environment.
Here are the steps to take, and the order in which to take them if you want to rename a server that has WSS3 or MOSS already installed and configured on it:
*** NOTE: Use only letters, digits and minus for the machine name (so no underscores), max 15 characters.
- Change each alternate access mapping for your WSS3 or MOSS deployment in Central Administration:
- Open Central Administration, “Operations” Tab, “Alternate access mappings” link
- Modify each mapping item to reflect your newly chosen server name
- Open a command prompt window
- cd “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN”
- stsadm -o renameserver -newservername -oldservername
- Start Menu | Control Panel | System, “Computer Name” tab, “Change” button.
- Input your new server name
- After reboot, open command prompt
- cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
- stsadm -o updatefarmcredentials -userlogin -password