ConfigPackageHandling/Remove-ConfigPackageInNavContainer.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<#
 .Synopsis
  Removes a configuration package from the application database in a NAV/BC Container
 .Description
  Create a session to a container and run Remove-NAVConfigurationPackageFile
 .Parameter containerName
  Name of the container in which you want to remove the configuration package from
 .Parameter configPackageCode
  The code of the configuration package you want to remove
 .Example
  Remove-ConfigPackageInNavContainer -containerName test2 -configPackageCode 'US.ENU.EXTENDED'
#>

function Remove-ConfigPackageInNavContainer {
    Param (
        [string] $containerName = "navserver",
        [Parameter(Mandatory=$true)]
        [string] $configPackageCode
    )

    Invoke-ScriptInNavContainer -containerName $containerName -ScriptBlock { Param($configPackageCode)
        Write-Host "Removing configuration package $configPackageCode"
        Remove-NAVConfigurationPackageFile -ServerInstance $ServerInstance -Code $configPackageCode -Force
    } -ArgumentList $configPackageCode
    Write-Host -ForegroundColor Green "Configuration package removed"
}
Set-Alias -Name Remove-ConfigPackageInBCContainer -Value Remove-ConfigPackageInNavContainer
Export-ModuleMember -Function Remove-ConfigPackageInNavContainer -Alias Remove-ConfigPackageInBCContainer