-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathSetupLicense.ps1
30 lines (26 loc) · 1.01 KB
/
SetupLicense.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
29
30
# INPUT
# $serviceTierFolder
# $licenseFile (optional)
#
# OUTPUT
#
if ($restartingInstance) {
# Nothing to do
} elseif ($licensefile -ne "") {
if ($licensefile.StartsWith("https://") -or $licensefile.StartsWith("http://"))
{
$licensefileurl = $licensefile
$licensefile = (Join-Path $runPath "license.flf")
Write-Host "Downloading license file '$licensefileurl'"
(New-Object System.Net.WebClient).DownloadFile($licensefileurl, $licensefile)
} else {
Write-Host "Using license file '$licensefile'"
if (!(Test-Path -Path $licensefile -PathType Leaf)) {
Write-Error "ERROR: License File not found."
Write-Error "The file must be uploaded to the container or available on a share."
exit 1
}
}
Write-Host "Import License"
Import-NAVServerLicense -LicenseData ([Byte[]]$(Get-Content -Path $licensefile -Encoding Byte)) -ServerInstance $ServerInstance -Database NavDatabase -WarningAction SilentlyContinue
}