How to unlock a Nav2013 database

February 13th, 2013

or how to add Yourself to an NAV 2013 db.

-- How to unlock a Nav2013-database

--Step 1:
--Fetch all Win-SID to a textfile

--Run this commad from a cmd-promt.
--c:>wmic useraccount get name,sid >>c:\temp\sid.txt

--Step 2:
--Find Your WIN-sid in the text-file (S-1-5-......) and paste it in to the sql-sqript below.

--Step 3: Change and run Sql-script.
USE [YourDatabase] -- <--Change this

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

SET @USERNAME = 'YOURDOMAIN\YOURUSER' -- <-- Change this
SET @WINDOWSSID = 'S-1-2-33-4444444444-5555555-6666666666-77777' -- <-- Change this
SET @USERSID = (select NEWID())

INSERT INTO
[dbo].[User]
(
[User Security ID],
[User Name],
[Full Name],
[State],
[Expiry Date],
[Windows Security ID],
[Change Password],
[License Type]
)
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]
)
VALUES
(
@USERSID,
'',
'',
'',
'',
'1753-01-01 00:00:00.000'
)

INSERT INTO [dbo].[Access Control]
(
[User Security ID],
[Role ID],
[Company Name]
)
VALUES
(
@USERSID,
'SUPER',
''
)

GO

2 Responses to “How to unlock a Nav2013 database”

  1. How to unlock a Nav2013 database | Pardaan.com Says:

    […] Bron : My tips Lees meer… […]

  2. SCL Direct Says:

    Sweet blog! I found it while browsing on Yahoo News.

    Do you have any suggestions on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get there! Appreciate it

Leave a Reply

*
To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word