Skip to main content
Microsoft Dynamics NAV forum
Unanswered

Creating User via Code

editSubscribe (0) ShareShare
ReportReport
Posted on by 77

Hello All,

Can we create user dynamically via coding. Because while creating a Test Codeunit i needs to test either database has already user or not, If there is no user then it will get created automatically with their windows account.

Answers and suggestions will be appreciated.

  • Murari Jangid Profile Picture
    Murari Jangid 77 on at
    RE: Creating User via Code

    I have done the above problem with another solution, Anyway thanks for your valuable time.

  • Suresh Kulla Profile Picture
    Suresh Kulla 43,636 on at
    RE: Creating User via Code

    Use the New-NAVServerUser cmdlet to create the users, you can execute the powershell command using the code, please check the below blog how to execute powershell from CAL

    blogs.msdn.microsoft.com/.../coffee-break-use-the-powershell-runner-add-in

  • Stefano Demiliani Profile Picture
    Stefano Demiliani 37,152 on at
    RE: Creating User via Code

    You can use POwershell and the New-NavServerUser cmdlet:

    https://docs.microsoft.com/en-us/powershell/module/microsoft.dynamics.nav.management/new-navserveruser?view=businesscentral-ps

    No other ways are recommended.

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,066 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,585 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans