AXForum  
Вернуться   AXForum > Microsoft Dynamics NAV > NAV: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 30.06.2017, 03:32   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
waldo: Import-NAVModules: An easy way to import NAV PowerShell modules
Источник: https://dynamicsuser.net/nav/b/waldo...rshell-modules
==============

I seem to remember that I have told you that I have created some modules in PowerShell to make my (and your) life easier in Microsoft Dynamics NAV.. ;-).

Well – it seems that these modules are getting some traction. They are available on Github, and the PowerShell Gallery – and people seem to be downloading them quite a lot.

Now, I had the pleasure of someone that added some very interesting functionality. Functionality that I had been working on, but I wasn’t able to get it working like the way I wanted it. Namely an easy way to import the NAV Powershell Modules. You know, when working in PowerShell ISE (or VSCode these days), you always need to load Microsoft’s commandlets by using code like this:

Import-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\100\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1" -WarningAction SilentlyContinue | out-nullImport-Module "$env:ProgramFiles\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1" -WarningAction SilentlyContinue | Out-NullImport-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\100\RoleTailored Client\Microsoft.Dynamics.Nav.Apps.Tools.psd1" -WarningAction SilentlyContinue | Out-NullE-ve-ry single time when you open the PowerShell ISE environment you need to load these modules. Sure there are ways to do that automatically – but you see as well that it’s bound to a version. This is just cumbersome.. .

I wanted to have an easy function “Import-NAVModules” that does just that – that figures out what you have installed on the system, and loads the module in the background.

The problem I had was the scope – I didn’t seem to be able to load the modules in the global scope. So, I was able to find and load the modules – but only in the function that was executing. When the function was done – my runspace still wasn’t loaded with the NAV modules..

And then there was Koubek

He forked into my modules on github, fixed my problem .. and even went one or two steps further.. and offered to import his changes with a pull request. Happy days :-). The function now figures out all versions on your system .. if you have multiple versions, it will let you select the version of NAV of which you want to load the PowerShell modules of .. and you can go from there.. . How cool is that :-). Working with multiple versions of NAV on one system just became a lot easier. I have to say it – I love the community :-).

A short demo:



I use this function every single day. The only thing I do now when I open PowerShell, is simply “Import-NAVModules” and all the default NAV commandlets are available to me.. . And if you have multiple versions installed .. you get to choose which version, like demonstrated in this screenshot:



You want this as well?

It’s all online. The easiest way to get my modules on your machine, is by simply execute this in PowerShell:

Find-Module | where author -eq waldo | install-module

Or you can also just download them (or fork) on github: https://github.com/waldo1001/Cloud.R...are.PowerShell




Источник: https://dynamicsuser.net/nav/b/waldo...rshell-modules
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
german_nav_developer: Buildnummern-Übersicht Microsoft Dynamics NAV 2013 Blog bot NAV: Blogs 0 15.05.2016 18:12
Platform updates overview - 3.70.B - NAV2009 R2 Blog bot Dynamics CRM: Blogs 0 07.02.2011 22:06
german_nav_developer: Buildnummern-Übersicht Microsoft Dynamics NAV 2009 SP1 Blog bot Dynamics CRM: Blogs 0 11.06.2010 16:33
german_nav_developer: Buildnummern-Übersicht Microsoft Dynamics NAV 2009 Blog bot Dynamics CRM: Blogs 0 04.06.2010 13:21
Nav developer: Overview of NAV blogs in 2008 Blog bot Dynamics CRM: Blogs 0 07.12.2008 02:18
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 10:43.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.