NAV 2016 Object types

The following objects exist in Microsoft Dynamics NAV:

Table: describes how data is stored in the database.
Page: displays for example tabular data so users can create, read, update or delete records.
Report: prints information or manipulates data via so called processing-only reports.
Codeunit: an organized unit of code that can be reused by other object types.
Query: defines a relational datamodel for direct querying trough OData for example.
XMLport: with an XMLport you can import and export data in plaintext or XML.
MenuSuite: the MenuSuite describes how the menus should be displayed in the Windows Client.

With the Object Designer which is part of the Development Environment you are able to create, edit, delete or modify NAV objects. Please bear in mind that your license is probably preventing you to modify certain objects and other ‘Development’ tasks.

Invoke-WebRequest – Download files with PowerShell

The Invoke-WebRequest is a very useful and cool Cmdlet in my opinion. This Cmdlet enables you to download files from the internet. Why the need to use Invoke-WebRequest just to download a file? I can name some reasons but the main reason is because I perform repeatable tasks in my daily job as a Technical Consultant. So I’m striving to work as efficiënt as possible. As most of us experience: time is always an issue! For example: what if you need to perform 5 identical downloads every day on different machines every time to basically the same folder? I won’t do that manually everytime but I’m going to find or create a solution for it in order to simplify and automate the task and gain more time in the long run.

So, the first thing that came to my mind: Powershell.

I did some research on Technet. On Microsoft Technet I found this Cmdlet and more information about it ofcourse. After reading quickly through the page I didn’t saw any examples… I got unpatient :) So I immediately started the PowerShell ISE and just typed in the Cmdlet.

The Invoke-WebRequest cmdlet asked me an Uri. That sounds logical. So I entered the URI to the .NET Framework 4.6 Offline installer, because I needed it to download. I quickly found it that it didn’t produced the result I wanted. My goal was to download the file and to save it to my Desktop. So once again I checked the documentation on Technet. The Outfile parameter saves the output to a file. So after specifying a destination filename it all worked.

At the end I created a small script with some extra things like dynamic constructing the path to the current desktop and it resulted in a small script I now use a lot. I will share it so you may benefit or learn from it too:

PowerShell example: Download .NET Framework 4.6:

$DownloadURL="https://download.microsoft.com/download/C/3/A/C3A5200B-D33C-47E9-9D70-2F7C65DAAD94/NDP46-KB3045557-x86-x64-AllOS-ENU.exe"
$Path_Desktop="$env:USERPROFILE\Desktop"
$Path_DotNetSetup46="$Path_Desktop\NDP46-KB3045557-x86-x64-AllOS-ENU.exe"
# Download: Microsoft .NET Framework 4.6 (Offline Installer) for Windows Vista SP2, Windows 7 SP1, Windows 8, Windows 8.1, Windows Server 2008 SP2 Windows Server 2008 R2 SP1, Windows Server 2012 and Windows Server 2012 R2. URL: https://www.microsoft.com/en-US/download/confirmation.aspx?id=48137
Invoke-WebRequest -Uri $DownloadURL -OutFile $Path_DotNetSetup46 -Verbose
Write-Output ".NET Framework 4.6 download completed."