Select Page

Changes to Microsoft Dynamics NAV 2016 Administration Shell and Microsoft Dynamics NAV 2016 Development Shell cmdlets

Changes to Microsoft Dynamics NAV Cmdlets from Previous Release

The following sections provide an overview of the new, changed, and removed cmdlets in the Microsoft Dynamics NAV 2016 Administration Shell and Microsoft Dynamics NAV 2016 Development Shell since the previous release.

 

Changes to Microsoft Dynamics NAV 2016 Administration Shell Cmdlets

 

New Cmdlets

The following table includes the new cmdlets in the current release.

Cmdlet Description
Export-NAVEncryptionKey Exports an encryption key from a Microsoft Dynamics NAV Server instance to a password protected file.
Get-NAVTableConnection Gets a list of connections to external database tables from a Microsoft Dynamics NAV application.
Import-NAVEncryptionKey Imports an encryption key from a password protected file to a Microsoft Dynamics NAV Server instance.
New-NAVEncryptionKey Creates an encryption key in a password protected file.
New-NAVTableConnection Registers a connection to an external database table so the table can be used by the Microsoft Dynamics NAV application.
Remove-NAVTableConnection Removes a connection to an external database table from the Microsoft Dynamics NAV application.
Remove-NAVWebServerInstance Removes a Microsoft Dynamics NAV Web Server instance on IIS.

 

Changed Cmdlets

The following table includes the cmdlets that have changed in the current release.

Cmdlet Description
Dismount-NAVTenant ApplicationDatabaseCredentials parameter added.

ApplicationDatabaseName parameter added.

ApplicationDatabaseServer parameter added.

InputTenantRuntimeSettings parameter added.

InputTenantSettings parameter added.

InputObject parameter removed and replaced by InputTenantRuntimeSettings and InputTenantSettings parameters.

DoNotSaveConfiguration parameter removed.

Export-NAVData ApplicationDatabaseCredentials parameter added.

DatabaseCredentials parameter added.

Get-NAVCompany FileName parameter changed to FilePath.
Get-NAVDataFile FileName parameter changed to FilePath.
Get-NAVTenant ApplicationDatabaseCredentials parameter added.

ApplicationDatabaseName parameter added.

ApplicationDatabaseServer parameter added.

Import-NAVData ApplicationDatabaseCredentials parameter added.

DatabaseCredentials parameter added.

Mount-NAVApplication DatabaseCredentials parameter added.
Mount-NAVTenant ApplicationDatabaseCredentials parameter added.

ApplicationDatabaseName parameter added.

ApplicationDatabaseServer parameter added.

AzureKeyVaultSettings parameter added.

DatabaseCredentials parameter added.

DefaultTimeZone parameter added.

EncryptionProvider parameter added.

NasServicesEnabled parameter added.

RunNasWithAdminRights parameter added.

New-NAVServerInstance DatabaseCredentials parameter added.

Multitenant parameter added.

Set-NAVServerInstance DatabaseCredentials parameter added.
New-NAVServerUser ContactEmail parameter added.
Set-NAVServerUser ContactEmail parameter added.

 

Removed Cmdlets

The following table includes the removed cmdlets in the current release.

Cmdlet Description
Save-NavTenantConfiguration Saves the current tenant configuration on the specified Microsoft Dynamics NAV Server instance. Tenant information is now stored in the database.

 

Changes to Microsoft Dynamics NAV 2016 Development Shell Cmdlets

 

New Cmdlets

The following table includes the new cmdlets in the current release.

Cmdlet Description
New-NAVCrmTable Creates Microsoft Dynamics NAV table objects that are based on Microsoft Dynamics CRM entities.

 

Changed Cmdlets

The following table includes the cmdlets that have changed in the current release.

Cmdlet Description
None

 

Removed Cmdlets

The following table includes the removed cmdlets in the current release.

Cmdlet Description
None

Join and Split Text objects using PowerShell in NAV 2015

Hi,

Microsoft introduce so many new PowerShell Functions and Cmdlets for Development. We can see all list of commands under Microsoft Dynamics NAV 2015 Development Shell. To open development shell click on below icon from start menu or just search for keyword “dev nav” you will see below icon.

Picture1

Right click on that icon and Run as administrator. It will give full list of PowerShell Functions and Cmdlets. See below screen.

Picture2

Either we can access it through Default Windows PowerShell ISE. In Start Menu just search for keyword “powershell” you will see below icon.

Picture4

Right click on that icon and Run as administrator. You will see below screen.

Picture5

To load Development shell Command into Windows PowerShell ISE just type below command in script area and run it by using Run Script(F5) button, then you will get full list of Functions and Cmdlets which are available in Microsoft.Dynamics.Nav.Model.Tools module.

Import-Module “C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1” force

Get-Help “NAV”

Picture6

Now we will see how to use Join and Split cmdlets.

JOIN

Combines multiple application object files into one text file.

Syntax

Join-NAVApplicationObjectFile [-Source] <String[]> [-Destination] <String> [-Force ] [-Confirm ] [-WhatIf ] [<CommonParameters>]

Description

Use the Join-NAVApplicationObjectFile to combine the application objects in the specified folder into a single text file.

Example

PS C:\>Join-NAVApplicationObjectFile -Source C:\Solution\TXT\COD*.txt -Destination C:\Solution\all-codeunits.txt

This example merges a list of files with application objects, such as COD1.TXT and COD2.TXT, into a single, larger file, all-codeunits.txt. When the merge completes, the status is shown with information about the file that was created.

SPLIT

Splits a text file that contains two or more application objects into separate text files for each application object.

Syntax

Split-NAVApplicationObjectFile [-Source] <String> [[-Destination] <String>] [-Force ] [-PassThru ] [-PreserveFormatting ] [-Confirm ] [-WhatIf ] [<CommonParameters>]

Description

Use the Split-NAVApplicationObjectFile cmdlet to split a text file that contains two or more application objects into separate text files for each application object. For example, if you have exported tables 18 and 27 to a single text file such as MySolution.txt, you can use the cmdlet to create two new text files, TAB18.txt and TAB27.txt.

The Split-NAVApplicationObjectFile cmdlet can copy each application object to a new file, or it can recreate the object in the new file. The default setting is to recreate the object, but you can change this by setting the PreserveFormatting parameter.

Examples

PS C:\>Split-NAVApplicationObjectFile -Source C:\Solution\All.txt -Destination C:\Solution\TXT\

This example creates separate text files for each application object in the All.txt file, such as TAB18.TXT and TAB27.TXT.

PS C:\>Split-NAVApplicationObjectFile -Source C:\Solution\All.txt -Destination C:\Solution\TXT\ -PreserveFormatting

This example creates separate text files for each application object in the All.txt file, such as TAB18.TXT and TAB27.TXT. By setting the PreserveFormatting parameter, each object is an exact copy, including extra line breaks or potential syntax errors. This makes it easier to compare files afterwards, for example.

In NAV 2015 PowerShell cmdlets are very useful and handy for any developer. so you can above cmdlets and save your development time. Now no need to use third-party tools to join and spilt NAV objects text files.

I just love these PowerShell cmdlets.  Are you? so start using it…