functions/invoke-d365dbsyncmodule.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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
<# .SYNOPSIS Synchronize all sync base and extension elements based on a modulename .DESCRIPTION Retrieve the list of installed packages / modules where the name fits the ModelName parameter. It will run loop over the list and start the sync process against all tables, views, data entities, table-extensions, view-extensions and data entities-extensions of every iterated model .PARAMETER Module Name of the model you want to sync tables and table extensions .PARAMETER LogPath The path where the log file will be saved .PARAMETER Verbosity Parameter used to instruct the level of verbosity the sync engine has to report back Default value is: "Normal" .PARAMETER BinDirTools Path to where the tools on the machine can be found Default value is normally the AOS Service PackagesLocalDirectory\bin .PARAMETER MetadataDir Path to where the tools on the machine can be found Default value is normally the AOS Service PackagesLocalDirectory .PARAMETER DatabaseServer The name of the database server If on-premises or classic SQL Server, use either short name og Fully Qualified Domain Name (FQDN) If Azure use the full address to the database server, e.g. server.database.windows.net .PARAMETER DatabaseName The name of the database .PARAMETER SqlUser The login name for the SQL Server instance .PARAMETER SqlPwd The password for the SQL Server user .PARAMETER ShowOriginalProgress Instruct the cmdlet to show the standard output in the console Default is $false which will silence the standard output .PARAMETER OutputCommandOnly Instruct the cmdlet to only output the command that you would have to execute by hand Will include full path to the executable and the needed parameters based on your selection .EXAMPLE PS C:\> Invoke-D365DbSyncModule -Module "Application*Adaptor" Retrieve the list of installed packages / modules where the name fits the search "Application*Adaptor". It will run loop over the list and start the sync process against all tables, views, data entities, table-extensions, view-extensions and data entities-extensions of every iterated model .NOTES Tags: Database, Sync, SyncDB, Synchronization, Servicing Author: Jasper Callens - Cegeka #> function Invoke-D365DbSyncModule { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [Alias("ModuleName")] [string] $Module, [string] $LogPath = "C:\temp\D365FO.Tools\Sync", [ValidateSet('Normal', 'Quiet', 'Minimal', 'Normal', 'Detailed', 'Diagnostic')] [string] $Verbosity = 'Normal', [string] $BinDirTools = $Script:BinDirTools, [string] $MetadataDir = $Script:MetaDataDir, [string] $DatabaseServer = $Script:DatabaseServer, [string] $DatabaseName = $Script:DatabaseName, [string] $SqlUser = $Script:DatabaseUserName, [string] $SqlPwd = $Script:DatabaseUserPassword, [switch] $ShowOriginalProgress, [switch] $OutputCommandOnly ) process { Invoke-TimeSignal -Start # Retrieve all sync elements of provided module name $allModelSyncElements = Get-SyncElements -ModuleName $Module # Build parameters for the partial sync function $syncParams = @{ SyncList=$allModelSyncElements.BaseSyncElements; SyncExtensionsList = $allModelSyncElements.ExtensionSyncElements; Verbosity = $Verbosity; BinDirTools=$BinDirTools; MetadataDir=$MetadataDir; DatabaseServer=$DatabaseServer; DatabaseName=$DatabaseName; SqlUser=$SqlUser; SqlPwd=$SqlPwd; ShowOriginalProgress=$ShowOriginalProgress; OutputCommandOnly=$OutputCommandOnly } # Call the partial sync using required parameters $resSyncModule = Invoke-D365DBSyncPartial @syncParams $resSyncModule Invoke-TimeSignal -End } } |