How to determine the version of PowerShell that is installed?

You can see the version of the PowerShell Engine by using the $PSVersionTable.PSVersion table. If you run Get-Help about_Automatic_Variables and read the contents of the $PSVersionTable you will get the following information:

Contains a read-only hash table that displays details about the version of Windows PowerShell that is running in the current session. The table includes the following items:
CLRVersion: The version of the common language runtime (CLR)
BuildVersion: The build number of the current version
PSVersion: The Windows PowerShell version number
WSManStackVersion: The version number of the WS-Management stack
PSCompatibleVersions: Versions of Windows PowerShell that are compatible with the current version
SerializationVersion: The version of the serialization method
PSRemotingProtocolVersion: The version of the Windows PowerShell remote management protocol

In-place upgrade Windows Server 2008 R2 Standard to Enterprise without Media

If you need to upgrade a server running Windows Server 2008 R2 Standard to either the Enterprise, or Datacenter editions you can use the installation image and choose the Upgrade option or the new command-line utility, introduced in Windows Server 2008 R2, DISM (Deployment Image Servicing and Management). With DSIM it is possible to perform the upgrade online, without the need to reinstall Windows or have the installation image. 

 To perform the upgrade in-place online, without the media image, first open an elevated command prompt (run as administrator) on the server to be upgraded. 

Type the command DISM /Online /Get-CurrentEdition. This will display the current Windows version. 

Type the command DISM /Online /Get-TargetEditions to list the Windows editions to which this server can be upgraded. 

Type the command DISM /Online /Set-Edition: <TargetEdition> (replace <TargetEdition> with the syntax for the desired edition returned by Get-TargetEditions). 

If you receive a message (Error 87) indicating that you need to specify a product key you can include it with the /ProductKey: parameter 

If you receive a message (Error 50) indicating that Setting an Edition is not supported then the machine may be a Domain Controller (DC) and it must be demoted before performing an online upgrade. You do not need to demote it if you are using the installation image. 

As always, be certain that you back up all of your settings and data prior to performing the upgrade.

Microsoft Dynamics Nav: Export objects License Range

One of the more tedious tasks when working on development using Microsoft Dynamics NAV is the exporting of Objects. You may need to export the objects to manage them in some sort of source control or to perform a code compare.

Often I have had to export all of the objects from a database (where the license has permission to export to text) and get held up having to work around objects that aren’t in the license range. There is the option is to filter those objects out before exporting the objects. This can be a difficult task as you may need to set different ranges for different object types.

The task of exporting object became easier with the addition of the EXPORTOBJECTS Function. This function allows you to export Dynamics NAV objects as either text or xml files. With this function you can automate the exporting of objects while comparing the object to the license permission information. The following snippet (codeunit attached to this post) demonstrates exporting objects that are contained within the license range:


PROCEDURE ObjectExport@1000000001(ObjectType@1000000000 : 'Table Data,Table,Form,Report,Dataport,Codeunit,XMLport,MenuSuite,Page';FilePath@1000000003 : Text[250]);
      Object@1000000001 : Record 2000000001;
      Object2@1000000006 : Record 2000000001;
      LicensePermission@1000000002 : Record 2000000043;
      Window@1000000007 : Dialog;
      RecNo@1000000008 : Integer;
      RecCount@1000000009 : Integer;
      prefix@1000000004 : Text[30];
      filename@1000000005 : Text[1024];

        Window.OPEN('#1#################################\' +
      Object.SETRANGE(Type, ObjectType);
      IF Object.FIND('-') THEN BEGIN
        RecCount := Object.COUNT;
            RecNo += 1;
            Window.UPDATE(1, STRSUBSTNO('%1 %2 %3', FORMAT(Object.Type), Object.ID, Object.Name));
            Window.UPDATE(2, ROUND(RecNo / RecCount * 10000,1));
          LicensePermission.SETRANGE("Object Type", Object.Type);
          LicensePermission.SETRANGE("Object Number", Object.ID);
          //LicensePermission.SETRANGE("Read Permission",1,2);
          LicensePermission.SETRANGE("Execute Permission",1,2);
          IF LicensePermission.FINDFIRST THEN BEGIN
            CASE ObjectType OF
              ObjectType::Table: prefix := 'Tab';
              ObjectType::Form:  prefix := 'For';
              ObjectType::Report: prefix := 'Rep';
              ObjectType::Dataport: prefix := 'Dat';
              ObjectType::Codeunit: prefix := 'Cod';
              ObjectType::XMLport: prefix := 'XML';
              ObjectType::MenuSuite: prefix := 'Men';
              ObjectType::Page: prefix := 'Pag';
              ERROR('Unsupported Object Type');
            Object2.SETRANGE(Type, Object.Type);
            Object2.SETRANGE(ID, Object.ID);
            filename := STRSUBSTNO('%1%2%3.txt', FilePath, prefix, FORMAT(Object.ID));
            EXPORTOBJECTS(filename, Object2);
        UNTIL (Object.NEXT = 0);


Note: This code is for NAV2009. NAV2013 does not support Forms and Dataports so the code will need to be slightly modified. Also, you can adapt the code to adjust the Object Filter and grab a specific set of objects by date, version list or any of the other object fields.

Cod50085.txt (2.89 kb)

Microsoft Dynamics NAV: What’s in the Option’s OptionString?

If you have ever tried to read data from Microsoft Dynamics NAV SQL tables then you quickly found out that Option type fields are stored in the table as integer values. Unfortunately, it is difficult for users to relate the option representation with the integer value. NAV performs the translation of the integer to the appropriate option value for display within the application and doesn’t offer much in the way of translation outside of the application.

Generally I have come across cases where people have built the translation directly into their source, as this SQL example:


Document_Type = CASE [Document Type]
		WHEN 0 THEN 'Quote'
		WHEN 1 THEN 'Order'
		WHEN 2 THEN 'Invoice'
		WHEN 3 THEN 'Credit Memo'
		WHEN 4 THEN 'Forecast Order'
		WHEN 5 THEN 'Return Order'
	ELSE ''


This may solve the issue of frustration however, what happens if options v alues are changed or added? Under this scenario the query would need to be recoded. Depending on the number of queries and their integration this can become tedious and time ($) consuming task.

So, what’s the alternative? Wouldn’t it be nice if you could dynamically read the options value? There really isn’t a dynamic way to externally translate the values outside of NAV however; you can read the values from a table. Before thinking that this requires a lot of data entry; NAV does allow for you to read these values from within the application.

Option OPtionString

The solution that I use is to dynamically populate (and update regularly) a table that contains the Table, Field and Option value information. This option allows for the selection of the option value based on table and field number. If option values are added, removed or changed they are reflected in the table and there isn’t a need to make any change to any queries.

I have attached to this post the text file for the objects used >>HERE<<.

Microsoft Dynamics NAV: MenuSuite Department Menu Bitmaps

In Microsoft Dynamics NAV 2013 you can modify or create a MenuSuite. One of the menu properties that you define when setting a MenuSuite is the Bitmap property. This identifies which of the internal resource images to display as the image for your MenuSuite.

Menu Properties

The valid range of numbers is 0 through 15. Here is an image that displays the bitmaps and their values:

Menusuite Department Images

Reading Stuff

Information in this document subject to change without notice.
All Software source code published is for demonstration and knowledge sharing purposes only. The Code is supplied "as is" without warranty as to result, performance or merchantability. Use at your own risk.
The opinions expressed herein are the opinions of the author and do not reflect those of any other entity.