<#Requires -Module IISAdministration,mdbc#> param( #[Parameter(ParameterSetName = 'Common')] $NSRVBusEndpoint, $HostedTenantID, $TeamsTenantId, $BackendFqdn, $BotFQDN, $langcode, #[Parameter(ParameterSetName = 'MeetingRecorderBackend')] $IISBindingThumbprint, $AADClientID, $AADClientSecret, $AADResourceId, $AuthClientID, $AuthClientSecret, $BotResourceId, $GoogleReCaptchaSiteID, $GoogleReCaptchaProjectId, $StorageAddress, $PremiumTrasnscriptionStorage, #[Parameter(ParameterSetName = 'MIAlarmManager')] $MonitorAppInsightsInstkey, $AzMntRG, $AzMntSubscriptionId, #[Parameter(ParameterSetName = 'OutlookDaemon')] $DaemonAppId, $DaemonClientSecret, $BackendAppInsightsInstkey, #DBSettings $AiSrvIPPort, $SiSrvIPPort, $SmtpUsrname, $SmtpPwd, $STTAzureBotKey, $STTAzureBotRegion, ########### $UserDomain, $KeyVaultUri, $AuthSecretName, $AadSecretName, $BotClientId, $BotClientSecret, $KeyVaultName #$RetentionDBInitScriptUri ) $RetentionEnabled = $false function DownloadZip($Path, $Url) { if (Test-Path -Path $Path) { Remove-Item -Path $Path -Recurse -Force } New-Item -Path $Path -ItemType "Directory" -Force $ZipFile = $Path + "\" + $( Split-Path -Path $Url -Leaf ) Start-BitsTransfer -Source $Url -Destination $ZipFile -RetryInterval 60 $ExtractShell = New-Object -ComObject Shell.Application $Files = $ExtractShell.Namespace($ZipFile).Items() $ExtractShell.NameSpace($Path).CopyHere($Files) Remove-Item -Force -Path $ZipFile } #region Install Module Start-Transcript -Path "C:\Installs\be_config.log" [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 foreach ($cert in (Get-ChildItem -Path Cert:\LocalMachine\my | Where-Object {$_.Subject -notmatch "Azure"})){ get-childitem -path cert:\localmachine\my | Where-Object {$_.Thumbprint -eq $cert.Thumbprint} | Remove-Item -Force -Verbose } get-service -Name akvvm_service | Stop-Service -Force -Verbose Get-Service -Name akvvm_service | Start-Service -Verbose Import-Module Mdbc -Verbose ### Auto Calculated Values ### $MIBuildPath = (Get-ChildItem -Path C:\Installs | Where-Object { $_.name -match ".*[2-5]\.[0-9]\.[0-1].*"}).FullName | sort -Descending if ($MIBuildPath.count -gt 1) { $MIBuildPath = $MIBuildPath[0] } #if more than one folder returned, take latest Start-Service -DisplayName 'World Wide Web Publishing Service' -Verbose Remove-Item "C:\Installs\TeamsClientTabApp" -Verbose -Force -Recurse -ErrorAction SilentlyContinue $AADomain = $BackendFqdn.replace("$($BackendFqdn.split(".")[0]).","") #Remove the first prefix of backend url. $LangString = "en-US" #multiple seperated by comma #$AADResourceId = "api://$BackendFqdn/$HostedTenantID" #$TokenRequestScope = "api://$BackendFqdn/$HostedTenantID/MeetingInsights.ReadWrite" $TokenRequestScope = "$AADResourceId/MeetingInsights.ReadWrite" $TeamsBotEndpoint = "https://$($BotFQDN):9441" #$BotResourceId = "api://$($BotFQDN)/$HostedTenantID" #region PROCESS Lang String $LangugeArray = @() $LangString.Split(",") | ForEach-Object { $HashTable = @{'code' = $_} $LangugeArray+=$HashTable } #endregion #region Functions Function Update-JsonEntryHash{ param( [CmdletBinding()] [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=0)] [string] [ValidateScript({test-path $_})] $JsonPath, [CmdletBinding()] [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=1)] $Hashtable, [CmdletBinding()] [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,Position=2)] $AddiontalDestinationPath ) function Update-JsonValuesFromHashTable{ param ($JsonPath,$hashtable) Function Get-JsonWoCommentsAsString{ param( [CmdletBinding()] [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=0)] [string] [ValidateScript({test-path $_})] $JsonPath ) (Get-Content "$JsonPath" -raw ) -replace '(?m)(?<=^([^"]|"[^"]*")*)//.*' -replace '(?ms)/\*.*?\*/' | ConvertFrom-Json } $j = Get-JsonWoCommentsAsString $JsonPath foreach ($key in $Hashtable.GetEnumerator()){ $entry = $key.key $value = $key.Value if (-not[string]::IsNullOrEmpty($key.Value)){ if (($key.Value).GetType().Name -eq "string"){ $value = ($value -join '"') } $n0 = [string]$entry.split(".")[0] $n1 = [string]$entry.split(".")[1] $n2 = [string]$entry.split(".")[2] $n3 = [string]$entry.split(".")[3] $n4 = [string]$entry.split(".")[4] if ($n4){ $j.$n0.$n1.$n2.$n3 | Select-Object {$_.$n4=$value} | Out-Null } elseif ($n3){ $j.$n0.$n1.$n2 | Select-Object {$_.$n3=$value} | Out-Null } elseif ($n2){ $j.$n0.$n1 | Select-Object {$_.$n2=$value} | Out-Null } elseif ($n1){ $j.$n0 | Select-Object {$_.$n1=$value} | Out-Null } else{ $j | Select-Object {$_.$n0=$value} | Out-Null } } else{ Write-Warning "$($key.key) has an empty value,please and try again." } } RETURN $j } function Format-Json([Parameter(Mandatory, ValueFromPipeline)][String] $json) { $indent = 0; ($json -Split "`n" | % { if ($_ -match '[\}\]]\s*,?\s*$') { # This line ends with ] or }, decrement the indentation level $indent-- } $line = (' ' * $indent) + $($_.TrimStart() -replace '": (["{[])', '": $1' -replace ': ', ': ') if ($_ -match '[\{\[]\s*$') { # This line ends with [ or {, increment the indentation level $indent++ } $line }) -Join "`n" } $j = Update-JsonValuesFromHashTable -JsonPath $JsonPath -hashtable $Hashtable #$OutFile = $JsonPath $OutFile = ($JsonPath | Split-Path)+"\"+($JsonPath | Split-Path -Leaf).split('\.')[0]+".json" if (Test-Path $OutFile -ErrorAction Ignore){ $date = (Get-Date -Format "MMddyyyyHHmm") $destinationpath = $OutFile+"."+$date+".bak" Copy-Item -path $OutFile -Destination $destinationpath -Verbose } #$j | ConvertTo-Json -depth 32| | Format-Json | set-content $OutFile -Force -Verbose $j | ConvertTo-Json -depth 32| Format-Json | % { [System.Text.RegularExpressions.Regex]::Unescape($_) } | set-content $OutFile -Force -Verbose if (Test-Path $AddiontalDestinationPath -ErrorAction Ignore){ $AddiontalDestinationPathOutFile = ($AddiontalDestinationPath | Split-Path)+"\"+($AddiontalDestinationPath | Split-Path -Leaf).split('\.')[0]+".json" if (Test-Path $AddiontalDestinationPathOutFile -ErrorAction Ignore){ $date = (Get-Date -Format "MMddyyyyHHmm") $adddestinationpath = $AddiontalDestinationPathOutFile+"."+$date+".bak" Copy-Item -path $AddiontalDestinationPathOutFile -Destination $adddestinationpath -Verbose } $j | ConvertTo-Json -depth 32| Format-Json | % { [System.Text.RegularExpressions.Regex]::Unescape($_) } | set-content $AddiontalDestinationPathOutFile -Force -Verbose } } function MongoDBUpdate { param( [Parameter(Mandatory=$true,ValueFromPipeline=$true)] [PSCustomObject] $Data, [Parameter(Mandatory=$true,ValueFromPipeline=$true)] [string] $dbServerName, [Parameter(Mandatory=$true,ValueFromPipeline=$true)] [string] $dbName, [Parameter(Mandatory=$true,ValueFromPipeline=$true)] [string] $TableName ) Connect-Mdbc . $dbServerName $dbName $dbObj = (Get-MdbcDatabase) | Where-Object {$_.DatabaseNamespace -eq $dbServerName} if (-not[string]::IsNullOrEmpty($dbObj)){ if ($Data.GetType().name -eq "String"){ $Data = $Data | ConvertFrom-Json } else{ $Data = ($Data | convertTo-Json -Depth 32) | ConvertFrom-Json } Update-MdbcData @{} @{'$set' = @{"$TableName" = $data }} -Result } else{ Write-Error "Cannot connect to $dbServerName" } } #endregion # Temp - patches for build 109 START DownloadZip -Path "$MIBuildPath\Patch109" "https://mistartifacts.blob.core.windows.net/miterraform/MI109_Patches.zip" -ErrorAction Stop $fileDateTime = $(get-date -f "dd_MMM_yyyy__HH_mm") $destinationPath = "C:\Program Files\AUDIOCODES\SpeakersIdentificationApp" Stop-Service -Name 'AudiocodesSI' -force -verbose Copy-Item -Path (Get-Item -Path "$destinationPath\*" -Exclude ('Logs')).FullName -Destination "$destinationPath-$fileDateTime" -Recurse Copy-Item -Path "$MIBuildPath\Patch109\SpeakersIdentificationApp\*" -Destination $destinationPath -Recurse -Force Start-Service -DisplayName 'Audiocodes Speaker Identification' $destinationPath = "C:\inetpub\MeetingRecorderBackend\UI" Copy-Item -Path (Get-Item -Path "$destinationPath\*" -Exclude ('Logs')).FullName -Destination "C:\inetpub\UI-$fileDateTime" -Recurse Copy-Item -Path "$MIBuildPath\Patch109\UI\*" -Destination $destinationPath -Recurse -Force # Temp - patches for build 109 END #leep 20 #cmd /c 'mongosh < "C:\Installs\RetentionDBInitScript\dbcreate.js"' #cmd /c 'mongosh < "C:\Installs\RetentionDBInitScript\RetentionDB.js"' #region JsonFilesUpdate #(Get-Content -Path $JsonPath -raw -Encoding UTF8).Replace("",$BackendFqdn).Replace("",$AuthClientID) | Set-Content -Path $JsonPath -Force -Verbose #$GoogleReCaptchaSiteID = "6LeHhdAgAAAAAMHfeXIJvVwwTBpbdvsWObyTFJG6" #$GoogleReCaptchaProjectId = "audcsaas" $MeetingRecorderBackend = @{ 'AzureAd.Domain' = $AADomain 'AzureAd.OurTenantId' = $HostedTenantID 'AzureAd.TenantId' = $TeamsTenantId 'AzureAd.ClientId' = $AADClientID 'AzureAd.ClientSecret' = $AADClientSecret 'AzureAd.ResourceId' = $AADResourceId 'SystemAzureAdUiAppConfig.auth.ClientId' = $AuthClientID 'SystemAzureAdUiAppConfig.auth.ClientSecret' = $AuthClientSecret 'SystemAzureAdUiAppConfig.auth.Authority' = "https://login.microsoftonline.com/$TeamsTenantId" 'SystemAzureAdUiAppConfig.auth.RedirectUri' = "https://$BackendFqdn/ui/login-page.php,https://$BackendFqdn/ui/close.html,https://$BackendFqdn/ui/system.php" 'SystemAzureAdUiAppConfig.TokenRequest.Scopes' = @($TokenRequestScope) #Must Be under Array. 'Languages' = $LangugeArray #@(@{'code' = "en-US"}<#,@{'code' = "he-IL"},@{'code' = "ru-RU"}#>) #each lang should be an hash table inside array. 'TeamsAppInstallation.installEnabled' = $true 'TeamsAppInstallation.contentUrl' = "https://$BackendFqdn/ui/tab/simple.html" 'TeamsAppInstallation.websiteUrl' = "https://$BackendFqdn/ui/" #'TeamsAppInstallation.appCatalogId' = $TeamsAppInstAppCatalogId 'SystemAzureAdUiAppConfig.GoogleReCaptcha.SiteId' = $GoogleReCaptchaSiteID 'SystemAzureAdUiAppConfig.GoogleReCaptcha.ProjectId' = $GoogleReCaptchaProjectId 'Location.Blob.Enabled' = $true 'Location.Blob.ConnectionString' = $StorageAddress 'Location.Blob.ContainerName' = "meetings" 'PostProcessing.RemoteEnabled' = $true 'OutlookAddOnPath' = "files/outlookAddOn.zip" } If ($AzMntSubscriptionId -eq "b64b38f5-740e-4978-8468-629c2fe120b6") { $EmsAddress = "192.168.213.100" } elseif ($AzMntSubscriptionId -eq "2de1ac14-adb1-4f91-9169-b7048ab790ad") { $EmsAddress = "192.168.200.139" } else { $EmsAddress = "" } $b4date = $(Get-Date -Format "MM/dd/yyyy") $alarmManagerSBusEndpoint = $NSRVBusEndpoint -replace 'sb://' $MIAlarmManager = @{ 'EmsSettings.EmsAddress' = "$EmsAddress" 'AdminInfo.serialNum' = "$BackendFqdn" 'MIServerSettings.LoginUrl' = "https://$BackendFqdn/ui/login-page.php" 'InboundTopic.Endpoint' = $alarmManagerSBusEndpoint 'InboundTopic.Topic' = "mialarms" 'InboundTopic.Subscription' = "alarms-manager" 'ApplicationInsights.InstrumentationKey' = $MonitorAppInsightsInstkey 'AzureMonitorSettings.TenantId' = $HostedTenantID 'AzureMonitorSettings.SubscriptionId' = $AzMntSubscriptionId 'AzureMonitorSettings.ResourceGroup' = $AzMntRG 'AzureMonitorSettings.IgnoreBeforeDate' = $b4date #'AzureMonitorSettings.AlertRulesFilter' = @("CogntSrvAlarm", "secondAlert") #'MIServerSettings.Address = ? #'AzureMonitorSettings.ClientId' = $AzMntClientId ??? #'AzureMonitorSettings.ClientSecret' = $AzMntClientSecret ??? #'EmsSettings.EmsAddress' = $EmsSettingsEmdAddress #'EmsSettings.OvocPublicIp' = $EmsSettingsOvocPubIp #'EmsSettings.OvocPublicUser' = $EmsSettingsOvocPubUser #'EmsSettings.OvocPublicPassword' = $EmsSettingsOvocPubPwd #'EmsSettings.SecurityName' = $EmsSettingsSecName #'EmsSettings.AuthenticationKey' = $EmsSettingsAuthKey #'EmsSettings.PrivateKey' = $EmsSettingsPrvKey } $OutlookDaemon = @{ 'App.applicationId' = $DaemonAppId 'App.backendWebServiceUri' = "http://localhost" 'App.teamsBotEndpoint' = $TeamsBotEndpoint 'App.clientSecret' = $DaemonClientSecret #'App.tenantId' = $TeamsTenantId 'App.tenantId' = $HostedTenantID 'App.hostTenantId' = $HostedTenantID 'App.botAuthResource' = $BotResourceId 'App.BEAuthenticationType' = "LocalUsersWithJwt" 'Backends.TenantId' = $TeamsTenantId 'Backends.BackendUri' = "https://$BackendFqdn/" 'ApplicationInsights.InstrumentationKey' = $BackendAppInsightsInstkey 'App.emailUri' = $SmtpUsrname #'Backends.Resource' = $BackendsResource } $SpeakersIdentificationApp = @{ 'ServiceBus.Endpoint' = $NSRVBusEndpoint 'ServiceBus.TopicName' = "ai-topic" 'ServiceBus.SubscriptionName' = "si_engine" 'MongoConnection.ConnectionString' = "mongodb://localhost" 'MongoConnection.Database' = "mrDB" } $SpeechTranscriptionApp = @{ 'InboundQueue.Endpoint' = $NSRVBusEndpoint 'InboundQueue.QueueName' = "stt-queue" 'ApplicationInsights.InstrumentationKey' = $BackendAppInsightsInstkey } $RecoveryService = @{ # 'ConnectionStrings.AzureServiceBus' = $NSRVBusEndpoint # 'ConnectionStrings.BlobStorage' = "" 'AzureServiceBus.FullyQualifiedNamespace' = $NSRVBusEndpoint -replace 'sb://' 'AzureServiceBus.TopicName' = "broadcastevents" 'AzureServiceBus.SubscriptionName' = "recover" 'BlobConfig.StorageAccountName' = $StorageAddress -replace 'https://' -replace '/' 'BlobConfig.BlobContainerName' = "meetings" 'AppRegistration.TenantId' = $HostedTenantID 'AppRegistration.Resource' = $AADResourceId 'AppRegistration.ClientId' = $BotClientId #'AppRegistration.ClientSecret' = $BotClientSecret 'AppRegistration.KeyVaultName' = $KeyVaultName 'PlatformOptions.IsMeetingInsights' = $true } $RetentionService = @{ # 'ServiceBus.ConnectionString' = "" 'ServiceBus.HostName' = $NSRVBusEndpoint -replace 'sb://' 'ServiceBus.RetentionTopicName' = "mi_to_retention" 'ServiceBus.CallRetentionSubscriptionName' = "call_retention_sub" 'ServiceBus.RetentionPolicySubscriptionName' = "retention_policy_sub" 'ServiceBus.ExpiredCallMediaMsgQueueName' = "retention_expired_call_media" 'ServiceBus.CallRetentionResultMsgTopicName' = "retention_to_mi" #'KeyVault.VaultUri' = $KeyVaultUri #'Secrets.Database.ConnectionString' = "" } copy-item "C:\Program Files\AUDIOCODES\RetentionService\appsettings.json.example" -Destination "$MIBuildPath\Release\Program Files\AUDIOCODES\RetentionService\appsettings.json.example" -force -verbose $JsonFilesUpdate = @{ "$MIBuildPath\Release\inetpub\MeetingRecorderBackend\appsettings.json.example" = $MeetingRecorderBackend "$MIBuildPath\Release\Program Files\AudioCodes\MIAlarmManager\appsettings.json.example" = $MIAlarmManager "$MIBuildPath\Release\Program Files\AudioCodes\OutlookDaemon\appsettings.json.example" = $OutlookDaemon "$MIBuildPath\Release\Program Files\AudioCodes\SpeakersIdentificationApp\appsettings.json.example" = $SpeakersIdentificationApp "$MIBuildPath\Release\Program Files\AudioCodes\SpeechTranscriptionApp\appsettings.json.example" = $SpeechTranscriptionApp "$MIBuildPath\Release\Program Files\AUDIOCODES\RecoveryService\appsettings.json.example" = $RecoveryService "$MIBuildPath\Release\Program Files\AUDIOCODES\RetentionService\appsettings.json.example" = $RetentionService } foreach ($key in $JsonFilesUpdate.GetEnumerator()){ $JsonPath = $key.key $Hashtable = $key.Value Write-Host "Processing Json File under - $JsonPath ...." -ForegroundColor Green $DestinationPath = $JsonPath.Replace("$MIBuildPath\Release","$env:SystemDrive") Update-JsonEntryHash -JsonPath $JsonPath ` -Hashtable $Hashtable ` -AddiontalDestinationPath $DestinationPath -Verbose } sleep 10 $RecoveryServicePath = "C:\Program Files\AUDIOCODES\RecoveryService\appsettings.json" (Get-Content -Path $RecoveryServicePath -raw).Replace(' "path": "%BASEDIR%\Logs\log-.txt",',' "path": "%BASEDIR%\\Logs\\log-.txt",') | Set-Content $RecoveryServicePath -Force -Verbose #region UpdateJsonSingle <# Update-JsonEntryHash -JsonPath "$MIBuildPath\Release\inetpub\MeetingRecorderBackend\appsettings.json.example" ` -Hashtable $MeetingRecorderBackend -Verbose Update-JsonEntryHash -JsonPath "$MIBuildPath\Release\Program Files\AudioCodes\MIAlarmManager\appsettings.json.example" ` -Hashtable $MIAlarmManager -Verbose Update-JsonEntryHash -JsonPath "$MIBuildPath\Release\Program Files\AudioCodes\OutlookDaemon\appsettings.json.example" ` -Hashtable $OutlookDaemon -Verbose Update-JsonEntryHash -JsonPath "$MIBuildPath\Release\Program Files\AudioCodes\SpeakersIdentificationApp\appsettings.json.example" ` -Hashtable $SpeakersIdentificationApp -Verbose Update-JsonEntryHash -JsonPath "$MIBuildPath\Release\Program Files\AudioCodes\SpeechTranscriptionApp\appsettings.json.example" ` -Hashtable $SpeechTranscriptionApp -Verbose #> #endregion #region MongoDb Configuration Connect-Mdbc . mrDB configuration $externalCognitiveServices = (Get-MdbcData).system.externalCognitiveServices $externalCognitiveServices | select {$_.inConnectionDetails.endpoint = $NSRVBusEndpoint} $externalCognitiveServices | select {$_.inConnectionDetails.queueName = "ext-queue"} $externalCognitiveServices | select {$_.outConnectionDetails.sttEngine.endpoint = $NSRVBusEndpoint} $externalCognitiveServices | select {$_.outConnectionDetails.sttEngine.queueName = "stt-queue"} $externalCognitiveServices | select {$_.outConnectionDetails.siEngine.endpoint = $NSRVBusEndpoint} $externalCognitiveServices | select {$_.outConnectionDetails.siEngine.topicName = "ai-topic"} $externalCognitiveServices | select {$_.outConnectionDetails.siEngine.label = "si_engine"} $alarmManagerServiceBusTopicInfo = (Get-MdbcData).system.alarmManagerServiceBusTopicInfo $alarmManagerServiceBusTopicInfo | select {$_.endpoint = $NSRVBusEndpoint} $supportedKWSEngines = (Get-MdbcData).system.supportedKWSEngines $supportedKWSEngines[0] | select {$_.serverUrl = "ws://$AiSrvIPPort/"} $supportedKWSEngines[1] | select {$_.serverUrl = "ws://$AiSrvIPPort/"} #$supportedSIEngines = (Get-MdbcData).system.supportedSIEngines #$supportedSIEngines[0] | select {$_.serverUrl = "ws://$SiSrvIPPort/"} $supportedSIEngines = @" [{ "serverUrl" : "ws://$SiSrvIPPort/", "contentType" : "audio/l16;rate=16000", "saveVoicePrint" : false, "saveWaveForm" : false, "enrollmentMaxScore" : 95, "apiVersion" : "v1", "similarityEnabled" : true }] "@ $postProcessingConfiguration = (Get-MdbcData).system.postProcessingConfiguration $postProcessingConfiguration | select {$_.inboundServiceBus.connectionString = $NSRVBusEndpoint } $postProcessingConfiguration | select {$_.inboundServiceBus.topic = "post-process-outbound" } $postProcessingConfiguration | select {$_.inboundServiceBus.subscription = "backend-update" } $postProcessingConfiguration | select {$_.outboundServiceBus.connectionString = $NSRVBusEndpoint } $postProcessingConfiguration | select {$_.outboundServiceBus.topic = "post-process-inbound" } $postProcessingConfiguration | select {$_.outboundServiceBus.subscription = "post-process" } $communications = (Get-MdbcData).system.communications $communications | select {$_.amqpCommunication.connectionString = $NSRVBusEndpoint } $communications | select {$_.retentionCommunication.inbound.connectionString = $NSRVBusEndpoint } $communications | select {$_.retentionCommunication.outbound.connectionString = $NSRVBusEndpoint } $supportedSTTEngines = (Get-MdbcData).system.supportedSTTEngines $supportedSTTEngines[4] | select {$_.manualSupport.blobStorage = $PremiumTrasnscriptionStorage} MongoDBUpdate -dbServerName mrDB -dbName configuration -TableName system.alarmManagerServiceBusTopicInfo -Data $alarmManagerServiceBusTopicInfo MongoDBUpdate -dbServerName mrDB -dbName configuration -TableName system.externalCognitiveServices -Data $externalCognitiveServices MongoDBUpdate -dbServerName mrDB -dbName configuration -TableName system.supportedKWSEngines -Data $supportedKWSEngines MongoDBUpdate -dbServerName mrDB -dbName configuration -TableName system.supportedSIEngines -Data $SupportedSIEngines MongoDBUpdate -dbServerName mrDB -dbName configuration -TableName system.postProcessingConfiguration -Data $postProcessingConfiguration MongoDBUpdate -dbServerName mrDB -dbName configuration -TableName system.communications -Data $communications MongoDBUpdate -dbServerName mrDB -dbName configuration -TableName system.supportedSTTEngines -Data $supportedSTTEngines Connect-Mdbc . mrDB system if ($langcode = "en-US"){$description = "English (United States)"} elseif ($langcode = "he-IL"){$description = "Hebrew (Israel)"} $lang = @(@{ code = $langcode description = $description }) $primarylang = @{ code = $langcode description = $description } $enabledSttEngines = (Get-MdbcData).enabledSttEngines $enabledSttEngines | select {$_.azure.azureCredentials = $STTAzureBotKey } $enabledSttEngines | select {$_.azure.serviceRegion = $STTAzureBotRegion } $enabledSttEngines | select {$_.azure.primaryLanguage = $primarylang} $enabledSttEngines | select {$_.azure.languages = $lang} $enabledSttEngines | select {$_.azure.enabled = $true} $enabledSttEngines | select {$_.verbit.audcCredentials = "19c9986b1173d2b30bcf48e4b08aa399"} $SMTPSetings = (Get-MdbcData).smtp $SMTPSetings | select {$_.smtpServer = "smtp.office365.com" } $SMTPSetings | select {$_.smtpPort = 587 } $SMTPSetings | select {$_.smtpUsername = $SmtpUsrname } $SMTPSetings | select {$_.smtpPassword = $SmtpPwd } $SMTPSetings | select {$_.useSsl = $false } $SMTPSetings | select {$_.from = $SmtpUsrname } $SMTPSetings | select {$_.to = $SmtpUsrname } $SMTPSetings | select {$_.serverUrl= "https://$BackendFqdn/" } $SMTPSetings | select {$_.enabled = $true } $aiFeatures = (Get-MdbcData).aiFeatures $aiFeatures | select {$_.voiceCommands.enableSystemAi = $true } $aiFeatures | select {$_.kwsEngine.kwsEngineName.kwsEngineName = "Voca" } $planner = (Get-MdbcData).supportedIntegrations.externalIntegrations.planner $planner | select {$_.userDomain = $UserDomain } ### TEMP CHANGE START $RecordingNotification = (Get-MdbcData).userProfiles $RecordingNotification[0] | select {$_.recordingNotification = $false} $RecordingNotification[1] | select {$_.recordingNotification = $false} $RecordingNotificationRoot = (Get-MdbcData).recordingNotification $RecordingNotificationRoot | select {$_.status = $true} $events = (Get-MdbcData).events $events | select {$_.enabled = $false} $events | ForEach-Object { if ($_._id -eq "MeetingReady"){ $_.enabled = $true } if ($_._id -eq "VoiceCommandComplete"){ $_.enabled = $true } if ($_._id -eq "MeetingRecapUpdated"){ $_.enabled = $true } } MongoDBUpdate -dbServerName mrDB -dbName system -TableName events -Data $events MongoDBUpdate -dbServerName mrDB -dbName system -TableName recordingNotification -Data $RecordingNotificationRoot MongoDBUpdate -dbServerName mrDB -dbName system -TableName userProfiles -Data $RecordingNotification ### TEMP CHANGE FINISH if ($RetentionEnabled -eq $false){ Get-Service -Name AudiocodesRetentionService | Set-Service -StartupType Disabled -Verbose $retention = (Get-MdbcData).retention $retention | select {$_.enabled = $false } } else{ Get-Service -Name AudiocodesRetentionService | Set-Service -StartupType Automatic -Verbose $retention = (Get-MdbcData).retention $retention | select {$_.enabled = $true } } MongoDBUpdate -dbServerName mrDB -dbName system -TableName retention -Data $retention MongoDBUpdate -dbServerName mrDB -dbName system -TableName enabledSttEngines -Data $enabledSttEngines MongoDBUpdate -dbServerName mrDB -dbName system -TableName smtp -Data $SMTPSetings MongoDBUpdate -dbServerName mrDB -dbName system -TableName aiFeatures -Data $aiFeatures MongoDBUpdate -dbServerName mrDB -dbName system -TableName supportedIntegrations.externalIntegrations.planner -Data $planner #endregion # Add MongoDB dependency to IIS (w3svc) $serviceName = "w3svc" $cmd = "config $serviceName depend= " (gsv $serviceName | Select ServicesDependedOn).ServicesDependedOn | % {$cmd += $_.Name + "/"} $cmd += "MongoDB" invoke-expression "sc.exe $cmd" # Fix mongodb sql connector binding ip (gc -Path "C:\Program Files\MongoDB\Connector for BI\2.14\mongosqld.conf" -raw) -replace '127.0.0.1','0.0.0.0' | Set-Content -Path "C:\Program Files\MongoDB\Connector for BI\2.14\mongosqld.conf" -force #Restart IIS Invoke-Expression -Command "cmd.exe /c IISReset /restart" Get-Service -displayname "AudioCodes*" | start-service -Verbose sleep 10 # disable server manager on logon Get-ScheduledTask -TaskName ServerManager | Disable-ScheduledTask -Verbose #endregion #region Ovoc Agent Installation #sleep 10 & netsh advfirewall firewall add rule name="OVOC-Agent" dir=in localport=8861 protocol=TCP action=allow $ovocPath = "C:\Packages\Ovoc\" $ovocConfigPath = "C:\Program Files\Audiocodes\AlarmsAgent\Config" $ovocArguments = "/I $ovocPath\OvocClientAgent.msi MainAgent=http://127.0.0.1 Type=MeetingInsights /quiet" Start-Process msiexec.exe -Wait -ArgumentList $ovocArguments Copy-Item -Path "$ovocPath\config\*" -Destination $ovocConfigPath -Recurse -Force Restart-Service "AlarmsAgent" -Force # Set Windows Defender exclusions $exclusions = @() $exclusions = @("C:\inetpub\MeetingRecorderBackEnd", ` "C:\MeetingRecorder", ` "C:\ffmpeg-3.4.1-win64-static\ffmpeg.exe", ` "C:\ffmpeg-3.4.1-win64-static\ffprobe.exe", ` "C:\strawberry", ` "C:\Program Files\ImageMagick-7.0.10-Q16", ` "C:\Program Files\ImageMagick-7.0.7-Q16", ` "C:\Program Files\AUDIOCODES", ` "C:\Program Files\MongoDB\Server\5.0\bin\mongo.exe", ` "C:\Program Files\MongoDB\Server\5.0\bin\mongod.exe", ` "E:\MongoDB") Set-MpPreference -ExclusionPath $exclusions -Force Get-service -Name AudiocodesRecoveryService | Set-Service -StartupType Automatic -Verbose $certificate = (Get-ChildItem -Path Cert:\LocalMachine\My\$IISBindingThumbprint | Select-Object -First 1) Remove-WebBinding -Name "MeetingRecorderBackEnd" -ErrorAction Ignore New-WebBinding -Name "MeetingRecorderBackEnd" -IP * -Port 443 -Protocol https New-WebBinding -Name "MeetingRecorderBackEnd" -IP * -Port 80 -Protocol http Remove-Item "IIS:\SSLBindings\0.0.0.0!443" -Force -ErrorAction Ignore Remove-Item "IIS:\SSLBindings\0.0.0.0!80" -Force -ErrorAction Ignore Remove-Item "IIS:\SSLBindings\0.0.0.0!443" -Force -ErrorAction Ignore Remove-Item "IIS:\SSLBindings\0.0.0.0!80" -Force -ErrorAction Ignore sleep 20 $certificate | New-Item "IIS:\SSLBindings\0.0.0.0!443" -Verbose -Force Write-Verbose "Certificate with thumbrpint $IISBindingThumbprint bound successfully " Stop-Transcript #Restart-Computer -Force