Monday, 15 January 2018

Renaming a local windows login after SQL Server Computer Name Change

I had an interesting issue last week. I had to rename non-domain (Workgroup) SQL Server Virtual Machine in Azure. The server was running the Database Engine, Reporting Services and Integration Services

I actually run through a blog post I wrote the best of 8 years ago titled Renaming a Standalone Instance of SQL Server and used the sp_dropserver sp_addserver scripts mentioned in that post. It all worked fine.

I also run through this article which looks specifically SSRS -Rename a Report Server Computer  

Again all worked fine. 

Everything was good except in the Security logins folder of the SQL Server instance.  I had logins listed as OldServerName\Windows_login. 

The machine/VM was not on a domain, so the logins were local windows accounts. I wanted them to show the new server name. I looked up how I can rename login a BOL and ALTER LOGIN allowed me to rename the Windows Logins.

I run the following script for each of the Windows Logins that needed renaming with the old server name reference and they were update correctly. 

ALTER LOGIN "OldServerName\Windows_Login"
WITH NAME="NewServerName\Windows_Login"

I thought I'd write a short post, as I spent about 20 minutes working out how to do this...Its not something I have to do very regularly.  

No comments:

Post a Comment

Featured post

OUT OF SUPPORT: SQL Server 2008 and SQL Server 2008 R2

Welcome to this post, on SQL Server 2008 and 2008 R2, both of these versions of SQL server will go out of  extended support with Microsoft t...