Add User in Dynamics NAV and Business Central On-premise with Powershell

If you have access to an account with local administrator privileges to a Windows box hosting the Dynamics NAV or Business Central service, you can add your own user very easily with Powershell.

Note: This post is about the on-premise version of Business Central (formerly Dynamics NAV), to add a user to Business Central Cloud/SaaS see here: Add User in Business Central Cloud / SaaS

This functionality has been available for quite sometime in Dynamics NAV and continues to be applicable to Business Central On-premise… so it surprises me how often I get asked for a NAV user by technical staff. I’ll now be forwarding this blog post when asked!

Another use for this of course (amongst other things) is when you need to restore a database which doesn’t contain a login you have access to. In the past we had to clear out the User related tables in SQL so NAV would give us access on first log on.

There are two Cmdlets we need:

New-NAVServerUser – Used to create the NAV user

New-NAVServerUserPermissionSet – Used to assign a Permission Set to the user.

As of Business Central CU03, the Cmdlets still have “NAV” in their name.

So for example, using the Business Central or Dynamics NAV Administration Shell (run as administrator) we can add a new Windows user to NAV/BC and assign the SUPER Permission Set as follows:

> New-NAVServerUser ServiceInstanceName -WindowsAccount DOMAIN\User.Name
> New-NAVServerUserPermissionSet 
ServiceInstanceName -WindowsAccount DOMAIN\User.Name -PermissionSetId SUPER

If you want to add your currently logged on Windows user you can use the whoami command:

> New-NAVServerUser ServiceInstanceName -WindowsAccount $(whoami)
> New-NAVServerUserPermissionSet 
ServiceInstanceName -WindowsAccount $(whoami) -PermissionSetId SUPER

2 thoughts on “Add User in Dynamics NAV and Business Central On-premise with Powershell”

  1. Hello, good afternoon, evening or day, how can I add permission sets that belong to another extension? when I want to add the BASIC permission to a user I get an error.

    New-NAVServerUserPermissionSet : The Aggregate Permission Set does not exist. Identification fields and values: Scope=’Tenant’,App
    ID='{63CA2FA4-4F03-4F2B-A480-172FEF340D3F}’,Role ID=’LOGIN’

    The command I use is this
    New-NAVServerUserPermissionSet -ServerInstance BC200 -UserName Development -AppName “System Application” -PermissionSetId LOGIN -Scope System

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.