It’s a very simple Post on how to make a NAV User from SQL/Powershell. Many times we end up with the following Error.
Though if you are first user login in then you can follow this POST to quickly solve it out, but if there are many valid users then obviously not.
So the first step that need to be done is to open Powershell ISE with Administrator privilege. Now execute this command
$objUser = New-Object System.Security.Principal.NTAccount(“DOMAIN\USER”)
$strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
Once you will execute the above command, you will get the SID number. Save it off in Notepad OR somewhere. It will be used in the second step.
Now open SQL Server and you need to execute the following Query for that Database in which you wants your respective login. Paste the SID and the Username copied above.
DECLARE @USERSID uniqueidentifier, @WINDOWSSID nvarchar(119), @USERNAME nvarchar(50), @USERSIDTXT varchar(50)
SET @USERNAME = ‘DOMAIN\USER‘
SET @USERSID = NEWID()
SET @USERSIDTXT = CONVERT(VARCHAR(50), @USERSID)
SET @WINDOWSSID = ‘YOUR COPIED SID‘
INSERT INTO [dbo].[User]
([User Security ID],[User Name],[Full Name],[State],[Expiry Date],[Windows Security ID],[Change Password],[License Type]
INSERT INTO [dbo].[User Property]
([User Security ID],[Password],[Name Identifier],[Authentication Key],[WebServices Key],[WebServices Key Expiry Date],
[Authentication Object ID])
INSERT INTO [dbo].[Access Control]
([User Security ID],[Role ID],[Company Name])
Execute the above command. If it gets successfully executed then you can go and try to login and you will get logged in to RTC.