examples/Copy-Terms.ps1
Import-Module .\PSBlackboard.psm1 -Verbose -force #Get Datasources $ProdDataSources = Get-BBDataSources $TestDataSources = Get-BBDataSources -Environment Test -Verbose #Terms $ProdTerms = Get-BBTerms $TestTerms = Get-BBTerms -Environment Test #Other Variables $CreatedTerms = @() #For each prod term, determine if it needs to be made, # if it does, determine the corresponding data source ID in test and update it, then create the term in test. foreach ($Term in $ProdTerms){ #Determine if the term from prod exists in test. $MatchedTerm = $TestTerms | Where-Object {$_.externalId -eq $Term.externalId} #If it doesn't if (!$MatchedTerm) { #Determine the corresponding data source ID in test by comparing externalID's and update the datasource id. #If it doesn't, you'll want to run Copy-DataSources.ps1. $MatchedDataSoure = $TestDataSources | Where-Object {$_.id -eq $Term.dataSourceId} $Term.dataSourceId = $MatchedDataSoure.id $CreatedTerms += $Term | New-BBTerm -Environment Test -Verbose } } |