Creating Super User Using SQL Query

Creating Super User in NAV 2016 using SQL Query

Get the SID of the current user login

Open the command prompt.

Type the following command and click enter to get the SID of current user login:

whoami /user

Get SID of all users in the domain

Type the following command and click enter to get the SID of all the domain users:

wmic useraccount get name,sid

Run the query in SQL

Open Microsoft SQL Server Management Studio.

Right-click on the database in which you would like to create the user and select New Query.

Copy the following query and paste it in the New Query window:

NOTE: Make sure to replace <Domain Name>, <User Name> and <SID> with correct information.

DECLARE @USERSID uniqueidentifier, @WINDOWSSID nvarchar(119), @USERNAME nvarchar(50)

SET @USERNAME =
‘<Domain Name>\<User Name>’
/* Domain Name\User Name */

SET @USERSID =
NEWID();

SET @WINDOWSSID =
‘<SID>’
/* USER SID*/

INSERT
INTO [dbo].[User]


([User Security ID],[User Name],[Full Name],[State],[Expiry Date],

[Windows Security ID],[Change Password],[License Type],[Authentication Email],[Contact Email])


VALUES


(@USERSID,@USERNAME,,0,‘1753-01-01 00:00:00.000’,@WINDOWSSID,0,0,,)

INSERT
INTO [dbo].[User Property]


([User Security ID],[Password],[Name Identifier],[Authentication Key],[WebServices Key],[WebServices Key Expiry Date],[Authentication Object ID])


VALUES


(@USERSID,,,,,‘1753-01-01 00:00:00.000’,)

INSERT
INTO [dbo].[Access Control]


([User Security ID],[Role ID],[Company Name],[Scope],[App ID])


VALUES


(@USERSID,‘SUPER’,,0,‘00000000-0000-0000-0000-000000000000’)

GO

Click Execute, to run the query.

After successful execution, the specified user is created in the database. Please check Users page in NAV.

About Paresh Sharma

https://au.linkedin.com/in/itspareshsharma

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.