Thursday, 7 January 2016

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





















IdNameVersionPublisher
9a47a833-e22f-4812-ade314219c53EDD1.011.0.0.00Ashwini
3c88160c-e0eb-4fe1-b4f6-011e45d74b10EDD1.021.0.0.01Ashwini

 

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







































Id3c88160c-e0eb-4fe1-b4f6-011e45d74b10
NameEDD1.02
Version1.0.0.01
PublisherAshwini
DescriptionSecond Extension by Ashwini
Compatibility Id1.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







































AppId3c88160c-e0eb-4fe1-b4f6-011e45d74b10
AppNameEDD1.02
AppPublisherAshwini
AppDescriptionSecond Extension by Ashwini
AppVersion1.0.0.01
AppCompatibilityId1.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

 

 

 







































AppId3c88160c-e0eb-4fe1-b4f6-011e45d74b10
AppNameEDD1.02
AppPublisherAshwini
AppDescriptionSecond Extension by Ashwini
AppVersion1.0.0.01
AppCompatibilityId1.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

 

 

1 comment:

  1. […] [C] Useful Windows PowerShell cmdlets for managing Extensions in Dynamics Navision 2016 […]

    ReplyDelete