Add Current Windows User to a NAV Database

With our proliferation of development databases for our Dynamics Additions products, creating a Microsoft Dynamics NAV user for the current Windows user is something that I do relatively frequently.

Combining as it does my twin passions for NAV and PowerShell I thought it was worth a quick post.

Import-Module ‘C:\Program Files\Microsoft Dynamics NAV\100\Service\Microsoft.Dynamics.Nav.Management.psm1’

New-NavServerUser [ServerInstance] -WindowsAccount (whoami)
New-NavServerUserPermissionSet [ServerInstance] -WindowsAccount (whoami) -PermissionSetId SUPER

This will create a new Windows authenticated user in the database for the current Windows user and assign the SUPER permission set to them.

Replace [ServerInstance] with the name of a NAV server connected to the relevant database. The path in the Import-Module line is the default location for the management module for NAV 2017. Replace with the correct path for your installation if it is different.

Leave a Reply