Consider a scenario where Site Collection Administrator ends up deleting any of the OOB fields (sometimes even the one in _HIDDEN folder) and due to which the site functionality is affected as the association from content types would be broken. In these situations, we must re-create the missing OOB fields. To re-create an OOB field, we need the missing site column’s definitions XML. (You can use PowerShell or SharePoint Manager to dump the XML definitions and paste to XML file in this case)
This script takes into account the fact that two OOB fields are already deleted from affected site collection. I dumped out the XML schema for these deleted fields in “ImportSiteColumnsXML.xml” file from some other working site collection using PowerShell or SharePoint Manager and the actual script “ImportSiteColumnsFromXML.ps1” uses this schema file and attempts to re-create the deleted fields.
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery