functions/Import-BcManagement.ps1
function Import-BcManagement { [CmdletBinding()] param ( [Parameter()] [int]$MajorVersion ) $BcManagementPath = (Join-Path (Get-BcInstallationProperty -MajorVersion $MajorVersion -Component Service).Path 'Management') $NAVWebClientManagementPath = (Join-Path $BcManagementPath 'NAVWebClientManagement.psm1') if (Test-Path -Path $NAVWebClientManagementPath -PathType Container) { Import-Module (Join-Path $BcManagementPath 'NAVWebClientManagement.psm1') } else { $NAVWebClientManagementPath = (Join-Path (Get-BcInstallationProperty -MajorVersion $MajorVersion -Component WebClient).Path 'Modules\NAVWebClientManagement') if (Test-Path -Path $NAVWebClientManagementPath -PathType Container) { Import-Module (Join-Path $NAVWebClientManagementPath 'NAVWebClientManagement.psm1') } else { Write-Warning 'Business Central Web Client Management Module not found (not installed?)' } } $MicrosoftDynamicsNavManagementPath = (Join-Path $BcManagementPath 'Microsoft.Dynamics.Nav.Management.dll') if (Test-Path -Path $MicrosoftDynamicsNavManagementPath -PathType Container) { Import-Module (Join-Path $BcManagementPath 'Microsoft.Dynamics.Nav.Management.dll') -NoClobber } else { Write-Warning 'Business Central Service Management Module not found (not installed?)' } } |