Obwohl ich sehr viel mit PowerShell arbeite: Ich nutze sowohl die eine noch die andere der obigen Shells
so gut wie nie.
Generell würde ich empfehlen, sich gleich das
PowerShell ISE für NAV einzurichten.
Das Arbeiten damit macht Spaß, was man von den beiden Bordwerkzeugen (die sind nichts anderes als die normale PowerShell-Konsole mit automatischem Laden der Module) nicht behaupten kann. Die weiteren Möglichkeiten des ISE sind auch quasi unbegrenzt.
Der obige MSDN-Artikel weist auch schon, zumindest "durch die Blume", darauf hin:
Alternatively to running Microsoft Dynamics NAV 2016 Administration Shell and Microsoft Dynamics NAV 2016 Development Shell from where they are installed, you can import the relevant module into the Windows PowerShell Integrated Scripting Environment (ISE).
Wie man dort versionsbezogene Module per Mausklick laden kann, steht hier (für NAV 2015):
Load Dynamics NAV CmdLets in PowerShell ISE with ProfilesArtikel zur Profildateiverwaltung
Understanding the six profilesHow to use profilesCode für alle Versionen für die Profildatei.
Ab NAV 2016 ist für Cmdlets, die für Extensions (Nav.Apps.Tools) benötigt werden, eine dritte Importzeile vorhanden
.
Für andere Versionen die Pfade bei …\90\… bei weiteren Menüpunkten entsprechend anpassen: NAV 2017 …\100\…, NAV 2018 …\110\… damit die richtigen Module geladen werden.
- Code: Alles auswählen
$code =
{
Import-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\90\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1" -WarningAction SilentlyContinue | out-null
Import-Module "C:\Program Files\Microsoft Dynamics NAV\90\Service\NavAdminTool.ps1" -WarningAction SilentlyContinue | Out-Null
Import-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\90\RoleTailored Client\Microsoft.Dynamics.Nav.Apps.Tools.psd1" -WarningAction SilentlyContinue | Out-Null
}
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Load NAV 2016 CmdLets',$code,$null)
$code =
{
Import-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\80\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1" -WarningAction SilentlyContinue | out-null
Import-Module "C:\Program Files\Microsoft Dynamics NAV\80\Service\NavAdminTool.ps1" -WarningAction SilentlyContinue | Out-Null
}
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Load NAV 2015 CmdLets',$code,$null)
$code =
{
Import-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics NAV\71\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1" -WarningAction SilentlyContinue | out-null
Import-Module "C:\Program Files\Microsoft Dynamics NAV\71\Service\NavAdminTool.ps1" -WarningAction SilentlyContinue | Out-Null
}
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Load NAV 2013 R2 CmdLets',$code,$null)
Nachtrag: Bei BC die Pfade entsprechend anpassen
Microsoft Dynamics NAV ->
Microsoft Dynamics 365 Business Central- Code: Alles auswählen
$code =
{
Import-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics 365 Business Central\140\RoleTailored Client\Microsoft.Dynamics.Nav.Model.Tools.psd1" -WarningAction SilentlyContinue | out-null
Import-Module "C:\Program Files\Microsoft Dynamics 365 Business Central\140\Service\NavAdminTool.ps1" -WarningAction SilentlyContinue | Out-Null
Import-Module "${env:ProgramFiles(x86)}\Microsoft Dynamics 365 Business Central\140\RoleTailored Client\Microsoft.Dynamics.Nav.Apps.Tools.psd1" -WarningAction SilentlyContinue | Out-Null
}
$psISE.CurrentPowerShellTab.AddOnsMenu.Submenus.Add('Load BC 14.x CmdLets',$code,$null)
Im Beispielcode werden für die Programmverzeichnisse sowohl Umgebungsvariablen
${env:ProgramFiles(x86)} als auch feste Pfade
"C:\Program Files\…" statt
env:ProgramFiles verwendet. Der Grund hierfür ist, dass
env:ProgramFiles statt des 64bit-Ordners je nach System ggf. auch den 32bit (x86) findet. Bei Bedarf anpassen
.