I am working on some sharepoint farms of these types:-

  1. SP 2013 on-premises.
  2. SP 2016 on-premises.
  3. SharePoint Online.

Now when I want to move some Pages libraries between farms using the Import-SPWeb & Export-SPWeb operations, then for the Import operation to work correctly the term sets and terms need to have the same GUIDs inside the source farm (the farm i do the Export-SPWeb operation on) and the destination farm (the farm i do the Import-SPWeb operation on). for example if the Pages library contain managed metadata columns which are linked to term sets, then to preserve the association between the term set and the site column inside the imported list, then the term sets and terms' GUIds need to be the same on both farms.

so i usually create the term sets and terms using powershell inside the destination farm. where using power-shell i can in advance provide the GUID for these components, so the term sets and terms will have the same GUID inside different farms.after that i can import/export the pages libraries, and they got associated with the correct term sets and terms. here is a sample of the power-shell scripts i am talking about:-

$termSet = $termGroup.CreateTermSet("Departments","c7d65978-750d-451d-9cf2-96c35f9d16ea","1033")
#Connect to existing term set
$termset = $termGroup.Termsets["Departments"]
$term = $termSet.CreateTerm("Customer Services",1033,"54b5c0bd-f203-4798-b3c9-0a1143ffdb0b")

but today i got this concern if there are any risks of providing the GUIDs when creating Sharepoint components using powershell. so can anyone advice on these 2 points:-

  1. If in the future we create some components such as term sets & terms using the UI, so could we face a problem that sharepoint will try to assign a GUID which were already provided inside our power-shell script?

  2. Inside our power-shell scripts how we can be sure that the GUIDs we are providing are not being already assigned to other components? for example in the above script i am using GUIDs from FarmA for the term sets and terms, then i am creating these term sets and terms inside FarmB.. so is this a safe operation?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.