Patch/Cmdlets/NAV/Export-NAVLicense.ps1
<#
.SYNOPSIS Exports the license from the specified Microsoft Dynamics NAV database. .DESCRIPTION Exports the license from the specified Microsoft Dynamics NAV database. .PARAMETER DatabaseServer Specifies the SQL Server database server and instance. .PARAMETER DatabaseName Specifies the database containing the table with the license information that must be exported. .PARAMETER LicenseFilePath Specifies the location where the license information must be exported to. #> function Export-NAVLicense { [CmdletBinding()] param ( [parameter(Mandatory=$true)] [string]$DatabaseServer, [parameter(Mandatory=$true)] [string]$DatabaseName, [parameter(Mandatory=$true)] [string]$LicenseFilePath ) BEGIN { Write-Verbose "Export license from the application database of $DatabaseName" if(!(Test-Path -Path $LicenseFilePath -IsValid)) { Write-Error "Destination license file path $LicenseFilePath is not valid" } $licenseDirectory = [System.IO.Path]::GetDirectoryName($LicenseFilePath) if(!(Test-Path $licenseDirectory -PathType Container)) { New-Item -Path $licenseDirectory -ItemType Container | Out-Null } if(!(Test-Path -Path $LicenseFilePath -PathType Leaf)) { New-Item -Path $LicenseFilePath -ItemType File | Out-Null } Export-BlobData $DatabaseServer $DatabaseName $LicenseFilePath } } Export-ModuleMember -Function Export-NAVLicense |