Select your NAV module when starting the Powershell ISE

Those of you familiar with Powershell (and if you’re reading this, you’re interested in NAV & you’re remotely technical then you really should be) will know that the Powershell ISE is nearly always a superior environment. With scripting, Intellisense and the Commands explorer life could not be easier as a Powershell user – the commands are practically written for you.

But there has always been one shortcoming for me – writing ‘Import-Module’ every time I start a new instance of the environment. Even worse, having to potentially do so twice for NAV 2015.

But I have an answer for you all.

The more adventurous Powershell users out there are probably already with the concept of a profile script (details here)

I’ve been using this myself for a while now, but always found it irritating when I needed to administer on 2013/2013 R2, as I’d have to remove the auto-loaded 2015 modules & then import the appropriate NAVAdminTool. Now when I open Powershell I’m presented the following:

image

I press the button (or if I’m feeling particularly sumptuous I use keyboard shortcuts from the Alt key) and Powershell will import the modules for me.

In order to attain this for your own install of Powershell, you’ll need to copy the Powershell Script found in this zip file. Save this Powershell Script to

C:\Users\[your account name]\Documents\WindowsPowerShell

then open up Powershell & run the following command:

if (!(test-path $profile ))
{new-item -type file -path $profile -force

Now, whenever you open up the ISE you’ll be given the option to select which version of NAV module you require.

Leave a Reply