ObjectHandling/Import-ObjectsFromFolder.ps1
function Import-ObjectsFromFolder { Param( [Parameter(Mandatory=$false)] [string] $ContainerName, [Parameter(Mandatory=$true)] [string] $Folder, [Parameter(Mandatory=$false)] [pscredential] $Credential ) if ($null -eq $ContainerName -or $ContainerName -eq "") { $ContainerName = (Get-EnvironmentKeyValue -KeyName 'name') } if ($null -eq $Credential) { $NewCredential = New-CredentialFromEnvironmentJson if ($NewCredential -eq $false) { $Credential = [PSCredential]::new('sa', (ConvertTo-SecureString 'P@ssword1' -AsPlainText -Force)) } else { $Credential = [PSCredential]::new('sa', $NewCredential.Password) } } [version]$platform = (docker inspect $ContainerName | ConvertFrom-Json).Config.Labels.version if ($platform.Major -eq 11) { Enable-SymbolLoading -ContainerName $ContainerName Start-Sleep -Seconds 5 } if (Test-Path $Folder -PathType Container) { $files = Get-ChildItem -Path $folder -include ('*.TXT', '*.FOB') -Recurse $files | ForEach-Object { Import-ObjectsToNavContainer -containerName $ContainerName -objectsFile $_.FullName -sqlCredential $Credential -ImportAction Overwrite -SynchronizeSchemaChanges Force } Compile-ObjectsInNavContainer -containerName $ContainerName -SynchronizeSchemaChanges Force -sqlCredential $Credential } else { Write-Host "No Objects found" } } Export-ModuleMember Import-ObjectsFromFolder |