Microsoft Dynamics NAV 2015 and PowerShell

Recently, I was interviewed for an article from titled “Why Microsoft Dynamics NAV 2015 makes PowerShell more important than ever”.  I talked about some of the ways how PowerShell makes one’s job easier, and allow you to implement Microsoft Dynamics NAV more efficiently.  Enjoy!

Windows PowerShell is not new, but it is a tool that is gaining in importance as Microsoft Dynamics NAV upgrades grow increasingly complex and deployments enter the cloud, demand greater scale, automation, and reliability.
PowerShell is a shell scripting application – a command-line program that can accept advanced technical commands – developed by Microsoft for the purposes of task automation and configuration management of its applications and operating systems. The shell is based on the .NET framework and includes a command-line shell itself and a scripting language.

Simply put, PowerShell is a Microsoft programming tool that enables users to simplify and automate monotonous and repetitive tasks by creating scripts that combine multiple commands to improve efficiency, ensure accuracy and reduce the risk of mistakes.

So where exactly is PowerShell positioned in the Dynamics NAV universe?

“It’s in the tooling,” says Dynamics NAV MVP Eric Wauters, founding partners ofiFacto Business Solutions and a blogger who has been a long time champion of PowerShell. By tooling, Wauters is referring to three primary domains: development tools; server administration; and object management.

Many people compare PowerShell to the Microsoft DOS command prompt, Wauters says

“When you see the DOS prompt, you type in a command and you expect results,” he says. “And that is basically what PowerShell is.”

PowerShell relies on the Cmdlet (pronounced “command-let”) – a simple, single-function command-line tool built into the shell. When you put in a command you expect a result from the system, like getting back a collection of objects as a result.

“You can do stuff with them, like what you can do with an object [in NAV],” he said. “And that’s what makes PowerShell so powerful – the fact that it is command-based. Like if I want to merge objects, then I can write my script to merge objects the way I do it – which could be different from the way someone else does it.”

In NAV 2013, PowerShell capabilities were limited to server administrative tasks, meaning developers had reasonably little they could do with it after a system was installed. With the release of Dynamics NAV 2015, there are more pre-built PowerShell capabilities, which means developers should now take some time to learn about what’s new.

Tony Hemy, Software Development Manager, Encore Business Solutions, is one of those technical professionals now using PowerShell for Dynamics NAV for tasks such as building new instances of service tiers, and building multiple web client instances.

“The beauty of it is that you get some intelligence when you’re working with it,” he said. “So it gives you some clues into the information that you need to provide, which reduces the amount of mistakes you can make. And you can save those files so you can reuse them. It enables you to build simple consistency.”

For example, say Hemy wanted a customer’s IT team to run a process but the customer wasn’t going to give him access to their environment.

“I could write that PowerShell script up for them and I could send it to them, get them to run it and they’d get the results I was looking for without me having to come in and do it for them,” he said.
It’s also enabling for Hemy’s customers who don’t want to get involved in the nooks and crannies of servers and setting them up.

“We can send them the PowerShell script and walk them through how to use it themselves,” he said. “They really don’t have to understand the concepts that are going on in the background, they just have to run that script to get the results that they’re looking for from us.”

Microsoft has been creating new commands that can be used by Dynamics NAV developers or NAV server administrators to accelerate upgrades and automate administrative tasks like setting up new servers, web services, web clients, tablet clients, and user management.

For instance, the RapidStart upgrade code in Dynamics NAV 2015 is actually a set of PowerShell Cmdlets that can be used in PowerShell.

“With that set of Cmdlets, we can create scripts to automate the upgrade of objects. That usually was a really manual thing and now it can be automated with PowerShell. It saves a lot of merge time. Merging the objects was one part of the upgrade,” Wauters says.

For Wauters, that means three or four days of work now only takes three or four hours.

“I did spend some time writing the script, but now the script is there and I can reuse it all the time,” he says. “That’s for the merging part. The upgrade is not only merging, it’s also exporting, importing, compiling, and doing the fixes that an upgrade needs – things that can’t be automated. What is now able to be automated, Microsoft automated.”

Are You Receiving Our Newsletters?

Subscribe to receive our monthly newsletters with the latest updates all in one place! Get important product information, event recaps, blog articles, and more.


Monthly Newsletter Straight to Your Inbox