Friday, 20 June 2014

NAV 2013 R2 - Introduction to PowerShell.

Hi All,

With Release of NAV 2013 R2 Microsoft have introduced one more component of NAV Administrators.

Yes that is Microsoft Dynamics NAV 2013 R2 Administration Shell.

With Release of NAV 2013 R2 one more pr-requisite before installing Navision is Powershell which comes up with a windows Update.

Powershell can used to access all Cmdlets available for windows. we can also use same for running Cmdlets for NAV 2013.

What is Cmdlets?

A cmdlet is a lightweight command that is used in the Windows PowerShell environment. The Windows PowerShell runtime invokes these cmdlets within the context of automation scripts that are provided at the command line. The Windows PowerShell runtime also invokes them programmatically through Windows PowerShell APIs.

What is Microsoft Dynamics NAV Windows PowerShell Cmdlets?

Windows PowerShell cmdlets for Server Administration are available with Microsoft Dynamics NAV 2013 R2. The cmdlets are implemented in Windows PowerShell 3.0. Windows PowerShell 3.0 is included with Windows Server 2012 and Windows 8. For other versions of Windows supported for Microsoft Dynamics NAV 2013 R2, you can install it as part of the Windows Management Framework 3.0 on the Microsoft Download Center.

To start a Windows PowerShell session that includes the Server Administration cmdlets, on the Start menu, choose All Programs, and then choose Microsoft Dynamics NAV 2013 R2 Administration Shell. This opens a Windows PowerShell prompt.

To see the cmdlets that are available for administering Microsoft Dynamics NAV, type the following at the Windows PowerShell prompt.

Get-Command *NAVServer*



For details of Cmdlets for Navision use the link.

How to Use PowerShell?

In Start Menu search for Windows PowerShell ISE and Run it as administrtor.



Now for using NAV Commands you need to import the modules in Powershell, that can be done by execution below command.
-------------------------------------------------------------------------------------
#Prepare PowerShell
Import-Module 'C:\Program Files\Microsoft Dynamics NAV\71\Service\NavAdminTool.ps1'
-------------------------------------------------------------------------------------

Where C:\Program Files\Microsoft Dynamics NAV\71\Service\NavAdminTool.ps1 is the default path of Navision cmdlets.

Once imported, it will behave similar to Microsoft Dynamics Administration tool.



We will be using PowerShell in future post, so i would suggest pin the Powershell ISE Shortcut to the TaskBar.

Regards,
Sathish

No comments:

Post a Comment