Monthly Archives: May 2016

Login failed for user Administrator. Reason: Could not find a login matching the name provided. [CLIENT: ]

Spent last few hours in order to fix a sql server. The story is that we took an image of an existing server and made it work within another domain, by changing the server name and it’s domain we put that server in to a great trouble.

I was unable to login by any means to I decided to play and fix it before rebuilding a server from scratch after few searching a did following

Consider my server is only set up for windows authentications another twist in the menu

  • Stop SQL server from services
  • net start mssqlserver /c /m /t3604
  • it will put sql server in a kind of confusing state and service will show as starting but good to go
  • run SQLCMD with –E which is SQLCMD –E
  • now you are in sql server
  • CREATE LOGIN recovery WITH PASSWORD = ‘TopSecret 1’
  • Go
  • sp_addsrvrolemember ‘recovery’, ‘sysadmin’
  • Go
  • Once done go to registry by Regedit and find following key
  • “LoginMode”=dword:00000002 originally it should be 1 if it’s windows login otherwise it’s fine. I change it from 1 to 2
  • Kill SQL server process and restart SQL server services again
  • Boom login with SQL auth with give username and password with new hostname
  • Print current SQL server name print @@servername
  • sp_dropserver oldname;
  • GO
  • sp_addserver newname, local;
  • GO


Based on you requirement you can change the security mode again otherwise keep it


The remote computer that you are trying to connect to requires Network Level Authentication (NLA), but your Windows domain controller cannot be contacted to perform NLA. If you are an administrator on the remote computer, you can disable NLA by using the options on the Remote tab of the System Properties dialogue box

Recently spent few hours on the subjected issues

so far able to login with local user, no other local or domain user is able to access the server, machine is currently in AWS so don’t have any other option to access the server.

one in the server try to get power-shell script for msdn code gallery

Running the functions

First import the functions using the Dot Sourcing method

. .\Get-Set-NetworkLevelAuthentication.ps1

Use the function Get-NetworkLevelAuthentication to retrieve the current setting.


Use the function Set-NetworkLevelAuthentication to change the NLA setting

Set-NetworkLevelAuthentication -EnableNLA $true

details can be obtained from