-
Notifications
You must be signed in to change notification settings - Fork 0
/
Extension_Install.ps1
57 lines (50 loc) · 1.52 KB
/
Extension_Install.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<#
.SYNOPSIS
Load extensions for BC containers
.DESCRIPTION
This script will load extensions into container(s) of Dynamics BC
.NOTES
File Name: Extension.ps1
Author: Mathew Ealy
Requires Powershell 5.0
.LINK
https://github.com/MEaly58
#>
#Variables
$ContainerName = "Sandbox"
$TenantName="Default"
$ExtVersion="Version No"
$ExtName="Extension Name"
$ExtensionPath= C:\Path + $ExtName + "_" + $ExtVersion + "_Runtime.app"
#Actions (Need to find a better way to do this later)
$PublishExt=1
$InstallExt=1
#SyncExt must be a 1 to fire the SyncExtClean command.
$SyncExt=1
$SyncExtClean=1
#Check if BcContainerHelper module is installed & load it if it is. Download & load if not
if (Get-Module -ListAvailable -Name BcContainerHelper) {
Write-Output "Loading BcContainerHelper"
Import-Module BcContainerHelper
}
else {
Write-Output "BcContainerHelper Missing, intalling now"
Install-Module -Name BcContainerHelper
Import-Module BcContainerHelper
}
#Publish Extension
if ($PublishExt -eq 1) {
Publish-BcContainerApp -containerName $ContainerName -appFile $ExtensionPath -skipVerification -scope Tenant
}
#Sync Application
if ($SyncExt -eq 1) {
if ($SyncExtClean -eq 1) {
Sync-BcContainerApp -containerName $ContainerName -appName $ExtName -appVersion $Version -mode Clean
} else {
Sync-BcContainerApp -containerName $ContainerName -appName $ExtName -appVersion $Version
}
}
#Install Extension
if ($InstallExt -eq 1) {
Install-BcContainerApp -containerName $ContainerName -appName $ExtName -tenant $TenantName
}