Replication, SQL, Tip & Tricks

Database Replication – Part II

This post is in continuation to my earlier post. Please check if you missed.

Database Replication – Part I

As committed in this post we will cover practical approach.

Creating Windows Accounts for Replication

We will create a separate Windows account on the local server for the following agents:

Agent Location Account name
Snapshot Agent Publisher <machine_name>\repl_snapshot
Log Reader Agent Publisher <machine_name>\repl_logreader
Distribution Agent Publisher and Subscriber <machine_name>\repl_distribution
Merge Agent Publisher and Subscriber <machine_name>\repl_merge

In my case the Publisher and Distributor share the same instance of SQL Server. The Publisher and Subscriber may share the same instance of SQL Server, but it is not a requirement. If the Publisher and Subscriber share the same instance, the steps that are used to create accounts at the Subscriber are not required.

To create local Windows accounts for replication agents at the Publisher

  • At the Publisher, open Computer Management from Administrative Tools in Control Panel.
  • In System Tools, expand Local Users and Groups.
  • Right-click Users and then click New User.

DR-01

  • Enter repl_snapshot in the User name box, provide the password and other relevant information, and then click Create to create the repl_snapshot account.

DR-02

  • Repeat the previous step to create the repl_logreader, repl_distribution, and repl_merge accounts.

DR-03

DR-04

DR-05

  • Click Close.

DR-06

To create local Windows accounts for replication agents at the Subscriber

If using different computer, else this step can be skipped.

  • At the Subscriber, open Computer Management from Administrative Tools in Control Panel.
  • In System Tools, expand Local Users and Groups.
  • Right-click Users and then click New User.
  • Enter repl_distribution in the User name box, provide the password and other relevant information, and then click Create to create the repl_distribution account.
  • Repeat the previous step to create the repl_merge account.
  • Click Close.

Preparing the Snapshot Folder

To create a share for the snapshot folder and assign permissions

  • In Windows Explorer, navigate to the SQL Server data folder. The default location is C:\Program Files\Microsoft SQL Server\MSSQL.X\MSSQL\Data.
  • In my case I am using SQL Replication folder on C: drive
  • Create a new folder named repldata.
  • Right-click this folder and click Properties.
  • On the Sharing tab in the repldata Properties dialog box, click Share.
  • In the File Sharing dialog box, click Share, and then click Done.

DR-07

  • On the Security tab, click Edit.
  • In the Permissions dialog box, click Add. In the Select User, Computers, Service Account, or Groups text box, type the name of the Snapshot Agent account created in previous step above, as <Machine_Name>\repl_snapshot, where <Machine_Name> is the name of the Publisher. Click Check Names, and then click OK.

DR-08

  • Repeat the previous step to add permissions for the Distribution Agent, as <Machine_Name>\repl_distribution, and for the Merge Agent as <Machine_Name>\repl_merge.
  • Verify the following permissions are allowed:

repl_snapshot – Full Control

repl_distribution – Read

repl_merge – Read

DR-09

  • Click OK to close the repldata Properties dialog box and create the repldata share.

Today we have covered initial setup required to start with SQL Database Replication.

We will continue with next step in our next post.

Advertisement
Corfu Navision 2016, Development Tips, Extension Package, How To, Information, Tip & Tricks

Useful Windows PowerShell cmdlets for managing Extensions in Dynamics Navision 2016

Today I will list few cmdlets which will help you getting your task done while working with Extensions.

For Overview of Extensions, please see my earlier posts

Introducing Extensions in Microsoft Dynamics NAV 2016

Which Object types you can Include & Restrictions applicable to C/AL code in Extension Packages

Which Properties are Restricted in Extension Packages

Just a quick reference you can study in details using links of MSDN below every cmdlet.

Get-Help

To get Help about syntax and options for a specific cmdlet, type the following cmdlet.

Syntax: Get-Help <cmd name>

 

Export-NAVApplicationObject

The Microsoft.Dynamics.Nav.Model.Tools.psd1 module includes a function, Export-NAVApplicationObject, which runs the ExportObjects command. This means that you can run a command such as the following:

Export-NAVApplicationObject

–DatabaseServer MyServer

–DatabaseName “Demo Database NAV (7-1)”

–Path C:\UserData\MyPackage\ORIGINAL\MyObjects.txt

 

Export-NAVApplicationObjectLanguage

Exports captions from the specified text files with Microsoft Dynamics NAV application objects. The captions are exported to text files.

 

Syntax:

Export-NAVApplicationObjectLanguage

[-Source] <String[]>

[-Destination] <String>

[[-LanguageId] <String[]> ]

[-DevelopmentLanguageId <String> ]

[-Encoding <FileEncoding> ] [-Force] [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]

The resulting text files are similar to the multilanguage files that you can export in the Microsoft Dynamics NAV Development Environment. If your source files contain more than one language, you can choose to export one language, multiple languages, or all languages

 

Example:

PS C:\> Export-NAVApplicationObjectLanguage

–Source .\ORIGINAL\ -LanguageId “DEU”,”FRA”

-Destination .\RESULT\languages.txt

Click here for more details on MSDN

Export-NAVAppPermissionSet

Exports the specified permission set from a Microsoft Dynamics NAV database to a file.

 

Syntax:

Export-NAVAppPermissionSet

[-ServerInstance] <String>

-Path <String> -PermissionSetId <String[]>

[-Force] [-PassThru] [ <CommonParameters>]

 

Example:

PS C:\> Export-NAVAppPermissionSet

-ServerInstance DynamicsNAV90 -Path ‘.\PermissionSet.xml’

-PermissionSetId SUPER

 

This example exports the permission set with the ID “SUPER” in the database that is used by the DynamicsNAV90 server instance to the PermissionSet.xml file.

Click here for more details on MSDN

 

Split-NAVApplicationObjectFile

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>]

 

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.

Example:

PS C:\> Split-NAVApplicationObjectFile -Source C:\UserData\MyPackage\ORIGINAL\All.txt -Destination C:\UserData\MyPackage\ORIGINAL\TXT\ -PreserveFormatting

 

Click here for more details on MSDN

 

Compare-NAVApplicationObject

Compares text files with Microsoft Dynamics NAV application objects and then calculates the delta between the two versions. The result of the comparison is a number of text files with the calculated delta.

The Compare-NAVApplicationObject cmdlet compares the text files in the two specified folders and creates .delta files that describe the difference between the two versions

The cmdlet creates a text file for each application object that is different between the two versions.

Syntax:

Compare-NAVApplicationObject

[-OriginalPath] <String[]>

[-ModifiedPath] <String[]>

[-DeltaPath] <String>

[-Confirm] [-Force] [-Legacy] [-NoCodeCompression] [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]

 

Example:

PS C:\> Compare-NAVApplicationObject

–OriginalPath C:\UserData\MyPackage\ORIGINAL\*.txt

-ModifiedPath C:\ UserData\MyPackage \MODIFIED\*.txt

-DeltaPath C:\ UserData\MyPackage \DELTA

 

Below example compares the text files in the MODIFIED folder to the baseline in the ORIGINAL folder. The result of the comparison is put into the DELTA folder and also piped to the Update-NAVApplicationObject cmdlet, which applies the updates.

PS C:\> Compare-NAVApplicationObject

-OriginalPath .\ORIGINAL\*.txt

-ModifiedPath .\MODIFIED\*.txt

-DeltaPath .\DELTA -Force

-PassThru |   Update-NAVApplicationObject

-TargetPath .\TARGET\*.txt

-ResultPath .\RESULT –Force

Click here for more details on MSDN

 

Merge-NAVApplicationObject

Compares the changes that have been made to application objects between two versions of Microsoft Dynamics NAV, and applies the difference to a third set of application objects.

 

Syntax:

Merge-NAVApplicationObject

[-OriginalPath] <String[]>

[-ModifiedPath] <String[]>

[-TargetPath] <String[]>

[-ResultPath] <String>

[-DateTimeProperty <DateTimePropertyAction> ] [-DisableCommentOut] [-DocumentationConflict <DocumentationConflictAction> ] [-Force] [-Legacy] [-ModifiedProperty <ModifiedPropertyAction> ] [-PassThru] [-Strict] [-VersionListProperty <VersionListPropertyAction> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

 

You specify an original version and compare that to a latest version.

The difference is then applied to the target version.

The result of the merge is a number of text files with the merged application objects.

Any conflicts that the cmdlet cannot merge are identified in conflict files.

Example:

PS C:\> Merge-NAVApplicationObject

-OriginalPath C:\UserData\MyPackage \ ORIGINAL\*.TXT

-TargetPath C:\ UserData\MyPackage \TARGET \*.TXT

-ModifiedPath C:\ UserData\MyPackage \MODIFIED \*.TXT

-ResultPath C:\ UserData\MyPackage \RESULT\

 

Click here for more details on MSDN

 

Import-NAVApplicationObjectLanguage

Imports strings in the specified language into text files that contain Microsoft Dynamics NAV application objects.

 

Syntax:

Import-NAVApplicationObjectLanguage

[-Source] <String[]>

[-LanguagePath] <String[]>

[-Destination] <String>

[[-LanguageId] <String[]> ]

[-Encoding <FileEncoding> ] [-Force] [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]

Example:

PS C:\> Import-NAVApplicationObjectLanguage

–Source .\TAB18.TXT

-LanguageId “CHS”

-LanguagePath .\ALL-CHS.TXT

-Destination .\RESULT\

This command will import the CHS language into the Microsoft Dynamics NAV application object that is specified in the –Source parameter, TAB18.txt. The strings are imported from the text files in the ALL-CHS.txt file, and the result of the command is a text file in the RESULT folder, TAB18.txt, that includes captions in Chinese.

Click here for more details on MSDN

 

Get-NAVAppInfo

Gets information about a Microsoft Dynamics NAV extension based on the specified package file or the specified Microsoft Dynamics NAV Server instance.

 

Syntax:

  • Get-NAVAppInfo -Path <String> [ <CommonParameters>]

  • Get-NAVAppInfo [-ServerInstance] <String> [-CompatibilityId <Version> ] [-Id <Guid> ] [-Name <String> ] [-Publisher <String> ] [-Version <Version> ] [ <CommonParameters>]

  • Get-NAVAppInfo [-ServerInstance] <String> -Tenant <String> [ <CommonParameters>]

 

Example:

To see Microsoft Dynamics NAV extensions that are published to the DynamicsNAV90 server instance use below command.

PS C:\>Get-NAVAppInfo -ServerInstance DynamicsNAV90

Or

This command will return information about all Microsoft Dynamics NAV extensions that are published to the DynamicsNAV90 server instance by Ashwini.

PS C:\>Get-NAVAppInfo -ServerInstance DynamicsNAV90 -Publisher ‘Ashwini’

 

You will see output similar to shown below

Id Name Version Publisher
9a47a833-e22f-4812-ade314219c53 EDD1.01 1.0.0.00 Ashwini
3c88160c-e0eb-4fe1-b4f6-011e45d74b10 EDD1.02 1.0.0.01 Ashwini

 

Below command returns information about the extension with the specified name and version on the DynamicsNAV90 server instance.

PS C:\>Get-NAVAppInfo -ServerInstance DynamicsNAV90 -Name ‘EDD1.01’ -Version 1.0.0.00

Or

This command will return information about all Microsoft Dynamics NAV extensions that are installed for the tenant with the ID Tenant1 on the DynamicsNAV90 server instance.

PS C:\>Get-NAVAppInfo -ServerInstance DynamicsNAV90 -Tenant ‘Tenant1’

Or

This command will return information about all Microsoft Dynamics NAV extensions that are installed on a non-multitenant Microsoft Dynamics NAV Server instance.

PS C:\>Get-NAVAppInfo -ServerInstance DynamicsNAV90 -Tenant default

You will see output similar to shown below

Id 3c88160c-e0eb-4fe1-b4f6-011e45d74b10
Name EDD1.02
Version 1.0.0.01
Publisher Ashwini
Description Second Extension by Ashwini
Compatibility Id 1.0.0.00
Capabilities
Prerequisites
Dependencies

 

Click here for more details on MSDN

Get-NAVApplicationObjectProperty

Gets Microsoft Dynamics NAV application object properties from the specified application object text files.

 

Syntax:

Get-NAVApplicationObjectProperty [-Source] <String[]> [ <CommonParameters>]

 

Example:

PS C:\> Get-NAVApplicationObjectProperty -Source .\SOURCE\COD1.txt

Click here for more details on MSDN

 

Set-NAVApplicationObjectProperty

Sets Microsoft Dynamics NAV application object properties in the specified application object text files.

Syntax:

Set-NAVApplicationObjectProperty

[-TargetPath] <String[]>

[-DateTimeProperty <String> ]

[-ModifiedProperty <SetModifiedPropertyAction> ]

[-VersionListProperty <String> ]

[-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]

 

You can use the Get-NAVApplicationObjectProperty cmdlet to extract information about the application objects before you change them.

Example:

PS C:\> Set-NAVApplicationObjectProperty -TargetPath C:\UserData\MyPackage\RESULT\FinalObjects.txt -VersionListProperty ” EDD1.02″ – ModifiedProperty No -DateTimeProperty (Get-Date -Format g)

Click here for more details on MSDN

 

Update-NAVApplicationObject

Applies a set of deltas to the specified application objects. The files that describe the delta are generated by the Compare-NAVApplicationObject cmdlet.

Optionally, you can use the Set-NAVApplicationObjectProperty cmdlet to change the version or other properties. Then, you use Update-NAVApplicationObject cmdlet to apply the delta to target files.

Syntax:

Update-NAVApplicationObject

[-TargetPath] <String[]>

[-DeltaPath] <String[]>

[-ResultPath] <String>

[-DateTimeProperty <DateTimePropertyAction> ]

[-DisableCommentOut]

[-DocumentationConflict <DocumentationConflictAction> ]

[-ModifiedProperty <ModifiedPropertyAction> ]

[-VersionListProperty <VersionListPropertyAction> ]

[-Force] [-Legacy] [-PassThru] [-Strict] [-Confirm] [-WhatIf] [ <CommonParameters>]

 

Example:

PS C:\> Update-NAVApplicationObject -TargetPath C:\UserData\MyPackage \TARGET\*.txt -DeltaPath C:\UserData\MyPackage \DELTA\*.txt –ResultPath C:\UserData\MyPackage \RESULT\

 

Click here for more details on MSDN

 

Get-NAVAppManifest

Loads a manifest for a Microsoft Dynamics NAV extension from an external source , such as an .xml file.

 

Syntax:

Get-NAVAppManifest [-Path] <String> [ <CommonParameters>]

 

Example:

PS C:\> Get-NAVAppManifest -Path ‘.\Manifest-EDD1_02.xml’

You will see output similar to shown below

AppId 3c88160c-e0eb-4fe1-b4f6-011e45d74b10
AppName EDD1.02
AppPublisher Ashwini
AppDescription Second Extension by Ashwini
AppVersion 1.0.0.01
AppCompatibilityId 1.0.0.00
Capabilities {}
Prerequisites {}
Dependencies {}

 

Below command gets a manifest from an XML manifest file and then passes the manifest to the New-NAVAppPackage cmdlet to create a new extension package.

PS C:\> Get-NAVAppManifest

-Path ‘.\Manifest-Proseware SmartStuff.xml’ | New-NAVAppPackage

-Path ‘ C:\UserData\MyPackage\Manifest\EDD1.02.navx’

-SourcePath ‘C:\UserData\MyPackage \NavExtensionFiles’

Click here for more details on MSDN

 

Set-NAVAppManifest

Sets one or more available properties on an in-memory manifest for a Microsoft Dynamics NAV extension.

You can then write the updated manifest object to disk by using the New-NAVAppManifestFile cmdlet. The manifest is required when you create the extension package file (.navx) using the New-NAVAppPackage cmdlet.

Syntax:

Set-NAVAppManifest

[-Manifest] <NavAppManifest>

[-CompatibilityId <Version> ]

[-Dependencies <String[]> ]

[-Description <String> ]

[-Id <Guid> ]

[-Name <String> ]

[-Prerequisites <String[]> ]

[-Publisher <String> ]

[-Version <Version> ]

[ <CommonParameters>]

 

PS C:\> Get-NAVAppManifest -Path ‘ C:\UserData\MyPackage\MANIFEST\Manifest-EDD1_02.xml’ | Set-NavAppManifest -Version 1.0.0.01 -CompatibilityId 1.0.0.00 | New-NavAppManifestFile -Path ” C:\UserData\MyPackage\MANIFEST\Manifest-EDD1_02.xml” -Force

Gets a manifest from file, sets the version property and then saves the updated manifest back to file. By setting the Force parameter, the existing file is overwritten.

Click here for more details on MSDN

 

New-NAVAppManifest

Creates a new in-memory manifest object with the specified metadata for a Microsoft Dynamics NAV extension.

Syntax:

New-NAVAppManifest

[-Name] <String>

[-Publisher] <String>

[[-Id] <Guid> ]

[[-Description] <String> ]

[[-Version] <Version> ]

[[-CompatibilityId] <Version> ]

[-Dependencies <String[]> ]

[-Prerequisites <String[]> ]

[ <CommonParameters>]

 

The manifest is required when creating the Extension package file (.navx) using the New-NAVAppPackage cmdlet.

The manifest property values can be changed using the Set-NAVAppManifest cmdlet.

 

PS C:\>New-NavAppManifest

-Name ” EDD1.02″

-Publisher ” Ashwini ”

-Description ” Second Extension by Ashwini ”

-Version “1.0.0.01”

-CompatibilityId “1.0.0.00”

-Id 3c88160c-e0eb-4fe1-b4f6-011e45d74b10

-Dependencies C:\UserData\MyPackage\APPLICATION\EDD1.01.navx

-Prerequisites Table=18, CodeUnit=80

 

 

 

AppId 3c88160c-e0eb-4fe1-b4f6-011e45d74b10
AppName EDD1.02
AppPublisher Ashwini
AppDescription Second Extension by Ashwini
AppVersion 1.0.0.01
AppCompatibilityId 1.0.0.00
Capabilities {}
Prerequisites {Table=18, CodeUnit=80}
Dependencies {EDD1.01, Ashwini, 1.0.0.00}

 

Click here for more details on MSDN

New-NAVAppManifestFile

Creates a file with metadata for a Microsoft Dynamics NAV extension package.

Syntax:

New-NAVAppManifestFile

[-Path] <String>

[-Manifest] <NavAppManifest>

[-Force] [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]

 

Below command will create information in-memory manifest and then writes it to disk.

Because the example sets the Force parameter, the file will be overwritten if it already exists.

 PS C:\> New-NavAppManifest  -Name “EDD1.02”  -Publisher “Ashwini”  -Description ” Second Extension by Ashwini” | New-NavAppManifestFile -Path ” C:\UserData\MyPackage\ MANIFEST \Manifest-EDD1_02.xml” -Force

Click here for more details on MSDN

 

New-NAVAppPackage

Creates a Microsoft Dynamics NAV extension package file (.navx) at the specified location based on the specified manifest file and source files.

Syntax:

New-NAVAppPackage

[-Path] <String>

[-Manifest] <NavAppManifest>

[-SourcePath] <String[]>

[-Force] [-PassThru] [-Confirm] [-WhatIf] [ <CommonParameters>]

 

You can then use the package file to deploy the extension to a Microsoft Dynamics NAV Server instance.

 

Example:

PS C:\> New-NavAppManifest -Name ‘ EDD1.02’ -Publisher ‘Ashwini’ -Version 1.0.0.01 | New-NAVAppPackage -Path ‘ C:\UserData\MyPackage\APPLICATION\EDD1.02.navx’ -SourcePath ‘ C:\UserData\MyPackage\MyExtensionFiles’

Click here for more details on MSDN

 

Publish-NAVApp

Publishes a Microsoft Dynamics NAV extension to the app catalog of the specified Microsoft Dynamics NAV Server instance.

When the extension has been published, you can install it for individual tenants.

 

Syntax:

Publish-NAVApp

[-ServerInstance] <String>

[-Path] <String>

[[-PassThru]] [[-LogPath] <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

 

 

Example:

PS C:\> Publish-NAVApp -ServerInstance DynamicsNAV90 -Path ‘ C:\UserData\MyPackage \NAVAPP\EDD1_02.navx’

Publishes the Microsoft Dynamics NAV extension from the EDD1_02.navx package to the DynamicsNAV90 server instance.

Click here for more details on MSDN

 

Unpublish-NAVApp

Unpublishes a Microsoft Dynamics NAV extension from the app catalog of the specified Microsoft Dynamics NAV Server instance.

The extension cannot be unpublished if it is currently installed for a tenant of the specified Microsoft Dynamics NAV Server instance.

 

Syntax:

Unpublish-NAVApp

[-ServerInstance] <String>

[-Path] <String>

[-Confirm] [-WhatIf] [ <CommonParameters>]

 

Unpublish-NAVApp

[-ServerInstance] <String>

[-Name] <String>

[[-Publisher] <String> ]

[[-Version] <Version> ]

[-Confirm] [-WhatIf] [ <CommonParameters>]

Click here for more details on MSDN

 

Install-NAVApp

Installs a Microsoft Dynamics NAV extension for a tenant in the specified Microsoft Dynamics NAV deployment.

Syntax:

Install-NAVApp

[-ServerInstance] <String>

-Path <String>

[-Tenant <TenantId> ]

[-DoNotLoadData]

[-Force] [-PassThru] [ <CommonParameters>]

 

 

Install-NAVApp

[-ServerInstance] <String>

-Name <String>

[-Publisher <String> ]

[-Tenant <TenantId> ]

[-Version <Version> ]

[-DoNotLoadData]

[-Force] [-PassThru] [ <CommonParameters>]

 

Example:

PS C:\> Install-NAVApp -ServerInstance DynamicsNAV90 -Name ‘EDD1.02’ -Version 1.0.0.01 -Tenant ‘MyTenant’

 

Click here for more details on MSDN

 

Uninstall-NAVApp

Uninstalls a Microsoft Dynamics NAV extension for the specified tenant.

If other extensions have a dependency on the specified extension, you must specify if they must also be uninstalled. Set the Force parameter to automatically remove dependent extensions.

Syntax:

Uninstall-NAVApp

[-ServerInstance] <String>

-Path <String>

[-Tenant <TenantId> ]

[-DoNotSaveData] [-Force] [-PassThru] [ <CommonParameters>]

 

 

Uninstall-NAVApp

[-ServerInstance] <String>

-Name <String>

[-Publisher <String> ]

[-Tenant <TenantId> ]

[-Version <Version> ]

[-DoNotSaveData]

[-Force] [-PassThru] [ <CommonParameters>]

 

 

Example:

PS C:\> Uninstall-NAVApp

-ServerInstance DynamicsNAV90

-Name ”EDD1.02′

-Version 1.0.0.01

 

Click here for more details on MSDN

 

Get-NAVAppTenant

Gets a list of tenants where the specified Microsoft Dynamics NAV extension is installed.

You can specify the extension by name, publisher, or version.

You can use the returned list of tenants to apply general changes, such as uninstalling the extension for all tenants that currently have it installed.

 

Syntax:

Get-NAVAppTenant

[-ServerInstance] <String>

-Path <String>

[ <CommonParameters>]

 

 

Get-NAVAppTenant

[-ServerInstance] <String>

[-Name <String> ]

[-Publisher <String> ]

[-Version <Version> ]

[ <CommonParameters>]

 

 

PS C:\> Get-NavAppTenant -ServerInstance DynamicsNAV90 -Name ‘EDD1.02’ -Version 1.0.0.01 | Uninstall-NAVApp -ServerInstance DynamicsNAV90 -Name ‘EDD1.02’ -Version 1.0.0.01

Click here for more details on MSDN

 

Repair-NAVApp

Repairs a Microsoft Dynamics NAV extension by recompiling it against the current base application.

It is recommend that you restart the Microsoft Dynamics NAV Server instance after running the repair.

Syntax:

Repair-NAVApp

[-ServerInstance] <String>

[-Name] <String>

[[-Publisher] <String> ]

[[-Version] <Version> ]

[ <CommonParameters>]

 

 

Example:

PS C:\> Get-NAVAppInfo -ServerInstance DynamicsNAV90 | Repair-NAVApp

Click here for more details on MSDN

 

 

Error

Windows Error Reporting and Collecting Crash Dumps

For troubleshooting issues with Microsoft products in general, you can use Windows Error Reporting to report computer problems to Microsoft. Microsoft uses the problem reports to try to match descriptions of each problem to a solution. This feature is enabled by default, and generates detailed reports about the problem.

To troubleshoot application instability issues, we will often need crash dumps in addition. For Microsoft Dynamics NAV, a full crash dump might be required to provide sufficient details to isolate and fix the problem. Once crash dump is collected, contact support and provide the dump. There are number of ways and tools to collect a crash dump, but we’ll look at how to automate this action in a very simple way.

For more details see:- Here

 

Development Tips, How To

How to: Install a Windows Client Control Add-in Assembly

Microsoft Dynamics NAV Windows client control add-ins are provided in one or more Microsoft Framework .NET-based assemblies, which are .dll files. Control add-in assemblies must be installed on the following computers:

  • Computers that are running the Microsoft Dynamics NAV Windows client. Any Microsoft Dynamics NAV Windows client instance that will use the control add-ins, must be installed with the control add-in assemblies. Control add-in assemblies are not installed with the default Microsoft Dynamics NAV Windows client installation.
  • Computer that is running the Microsoft Dynamics NAV Development Environment. After a control add-in is installed, you use the development environment to register the control add-in the Client Add-in table in the Microsoft Dynamics NAV database and set it up on pages.

Optionally, if a control add-in has the same name as the assembly, you can install the assembly on the computer that is running Microsoft Dynamics NAV Server instead of the client computer.

To install control add-in assemblies on the Microsoft Dynamics NAV Windows client

  • If needed, install the Microsoft Dynamics NAV Windows client on the computer.
  • On the computer that is running the Microsoft Dynamics NAV Windows client, copy the assemblies that contain the control add-ins to the Add-ins folder of the Microsoft Dynamics NAV Windows client installation.
    • By default, the path of this folder is C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Add-ins.

You can also include assemblies in a subfolder of the Add-ins folder. This can be useful if you have multiple assemblies and dependencies.

To install control add-in assemblies on the development environment computer

  • If needed, install the development environment on the computer.
  • On the computer that is running the development environment, create a folder named Add-in in the development environment installation folder.
    • By default, the path of this folder is C:\Program Files\Microsoft Dynamics NAV\80\Classic. If the Add-in folder already exists, then ignore this step.
  • Copy the assemblies that contain the control add-ins to the Add-ins folder.

You can also include assemblies in a subfolder of the Add-ins folder. This can be useful if you have multiple assemblies and dependencies.

Installing Control Add-ins on Microsoft Dynamics Server for Automatic Deployment

If a control add-in has the same name as the assembly, then you can install the assembly on computer that is running Microsoft Dynamics NAV Server. When an operation from the client requires the control add-in, Microsoft Dynamics NAV Server automatically deploys the assembly to a temporary folder on the client computer.

For example, if Microsoft Dynamics NAV Windows client opens a page that contains a control add-in, Microsoft Dynamics NAV Server will find the control add-in assembly by name in the Add-ins folder. Then, it deploys the assembly to the client computer in the %TEMP%\Microsoft Dynamics NAV\Add-Ins folder of the user who is running the client. The deployed assembly will be then be used whenever the page is opened.

Similarly, if the development environment requires a control add-in, for example, when you compile an object, then the control add-in assembly will be deployed by the Microsoft Dynamics NAV Server to the local temporary folder for the current user on the computer that is running the development environment.

To be deployed, an assembly must comply with the following Microsoft Dynamics NAV Server configuration settings: Chunk Size, Max Upload Size, and Prohibited File Types.

If the control add-in assembly is updated and its version number changes, Microsoft Dynamics NAV Server will deploy the updated assembly to the client computer the next time that the client requests the assembly. The updated assembly is put in a subfolder of the %TEMP%\Microsoft Dynamics NAV\Add-Ins folder, where the subfolder has the assembly’s version number as its name. This implementation means that you do have to remove the older versions of assemblies that are stored on the client computer.

Before Microsoft Dynamics NAV Server deploys an assembly to a client, the client looks for the assembly in the local Add-ins folder (for example, C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Add-ins). If the assembly is not found, then the client will request the assembly from Microsoft Dynamics NAV Server.

To install the control add-in on Microsoft Dynamics NAV Server

  • On the computer that is running the Microsoft Dynamics NAV Server, copy the assembly that contains the control add-in to the Add-ins folder of the Microsoft Dynamics NAV Server installation.

By default, the path is C:\Program Files\Microsoft Dynamics NAV\80\Service\Add-ins.

Development Tips, How To

How to: Set .NET Framework Types to Run on the Microsoft Dynamics NAV Windows Client or Microsoft Dynamics NAV Server Computers

Here is the brief description for how to set .NET Framework objects that are instantiated by DotNet variables to target either the Microsoft Dynamics NAV Windows client or Microsoft Dynamics NAV Server.

By default, a type is set to target Microsoft Dynamics NAV Server. However, you can set the type to target the Microsoft Dynamics NAV Windows client.

Setting the .NET Framework Type to Target the Microsoft Dynamics NAV Windows Client

To set a .NET Framework type instance to target the Microsoft Dynamics NAV Windows client, you must complete the following tasks:

  • Set the DotNet variable for the .NET Framework type to target the Microsoft Dynamics NAV Windows client.
  • Copy the .NET Framework assembly to the computer that is running the Microsoft Dynamics NAV Windows client.

You must copy the assembly to each computer that is running the Microsoft Dynamics NAV Windows client. If the assembly is included in the global assembly cache, then you do not have to do this task.

For the Microsoft Dynamics NAV Web client, you cannot implement Microsoft .NET Framework interoperability objects that target the client.

To set the .NET Framework type to target the Microsoft Dynamics NAV Windows client

  • In Object Designer, open the C/AL code of the Microsoft Dynamics NAV object that uses .NET Framework interoperability.
  • Do one of the following steps:
    • For a global variable, on the View menu, choose C/AL Globals.
    • For a local variable, select the trigger that uses the variable, and then on the View menu, choose C/AL Locals.
    • On the Variables tab, select the DotNet variable, and then on the View menu, choose Properties.
    • In the Properties window, set the RunOnClient property to Yes

To copy a .NET Framework assembly to a computer that is running the Microsoft Dynamics NAV Windows client

    • On the computer that is running the Microsoft Dynamics NAV Windows client, copy the.NET Framework assembly to the Add-ins folder of the Microsoft Dynamics NAV Windows client installation.

By default, the path of this folder is C:\Program Files\Microsoft Dynamics NAV\80\RoleTailored Client\Add-ins or C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Add-ins.

You can also put assemblies in a subfolder of the Add-ins folder. This can be useful when you have multiple versions of the same assemblies and dependencies.

Setting the .NET Framework Type to Target Microsoft Dynamics NAV Server

To set a .NET Framework type instance to target Microsoft Dynamics NAV Server, you must complete the following tasks:

  • Set the variable for the NET Framework type to target Microsoft Dynamics NAV Server.
  • Copy the .NET Framework assembly to the computer that is running Microsoft Dynamics NAV Server.

If the assembly is included in the global assembly cache of the computer that is running Microsoft Dynamics NAV Server, then you do not have to do this task.

To set the .NET Framework type to target Microsoft Dynamics NAV Server

  • In the development environment, in Object Designer, open the object that uses the .NET Framework variable.
  • Do one of the following steps:
    • For a global variable, on the View menu, choose C/AL Globals.
    • For a local variable, in the C/AL Editor, select the trigger that uses the DotNet variable, and then on the View menu, choose C/AL Locals.
    • On the Variables tab, select the NET Framework variable type, and then on the View menu, choose Properties.
    • In the Properties window, set the RunOnClient property to No

To copy a .NET Framework assembly to the computer that is running Microsoft Dynamics NAV Server

    • On the computer that is running Microsoft Dynamics NAV Server, copy the.NET Framework assembly to the Add-ins folder of the Microsoft Dynamics NAV Server installation folder.

By default, the path of the Microsoft Dynamics NAV Server installation folder is C:\Program Files\Microsoft Dynamics NAV\80\Service\Add-ins.

You can also put assemblies in a subfolder of the Add-ins folder. This can be useful when you have multiple assemblies and dependencies.

If you are working in the development environment, to compile and test Microsoft Dynamics NAV objects, you must also copy the assembly to the Add-ins folder of the Microsoft Dynamics NAV Windows client installation on the computer that is running the development environment. By default, the path of this folder is C:\Program Files\Microsoft Dynamics NAV\80\RoleTailored Client\Add-ins or C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client\Add-ins.