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('admin', (ConvertTo-SecureString 'P@ssword1' -AsPlainText -Force)) } else { $Credential = $NewCredential } } if (!(Test-Path $Folder -PathType Container)) { throw "$Folder does not exist." } $files = Get-ChildItem -Path $folder -Recurse $files | ForEach-Object { Import-ObjectsToNavContainer -containerName $ContainerName -objectsFile $_.FullName -sqlCredential $Credential -ImportAction Overwrite -SynchronizeSchemaChanges Force } Compile-ObjectsInNavContainer -containerName $ContainerName -SynchronizeSchemaChanges Force -sqlCredential $Credential } Export-ModuleMember Import-ObjectsFromFolder |