diff --git a/openbis/dist/server/export-master-data.py b/openbis/dist/server/export-master-data.py
index c71335fa8f5ed9d737b1a11c5fbc4b6e272d56fa..bd324bfeabac4e53bd071914fc5dfdd354109335 100644
--- a/openbis/dist/server/export-master-data.py
+++ b/openbis/dist/server/export-master-data.py
@@ -81,6 +81,14 @@ def codeLiteral(code):
         normalized = code[1:]
     return strLiteral(normalized)
 
+def createValidationScriptAssigment(entityType, var):
+    validationScript = entityType.getValidationScript()
+    if (validationScript == None):
+        return ""
+    else:
+        script = getVarName("SCRIPT", replaceSpace(validationScript.getName()))
+        return "%s.setValidationScript(%s)" % (var, script)
+
 
 def exportFileFormatType(fileType):
     var = getVarName("FILE_FORMAT", fileType.getCode())
@@ -153,9 +161,11 @@ def exportExperimentType(experimentType):
     var = getVarName("EXPERIMENT", experimentType.getCode())
     code = codeLiteral(experimentType.getCode())
     description = strLiteral(experimentType.getDescription())
+    validationScript = createValidationScriptAssigment(experimentType, var)
     return """
 %(var)s = tr.getOrCreateNewExperimentType(%(code)s)
 %(var)s.setDescription(%(description)s)
+%(validationScript)s
 """ % vars()
 
 def exportSampleType(sampleType):
@@ -169,6 +179,7 @@ def exportSampleType(sampleType):
     isAutoGeneratedCode = sampleType.isAutoGeneratedCode()
     isShowParentMetadata = sampleType.isShowParentMetadata()
     generatedCodePrefix = strLiteral(sampleType.getGeneratedCodePrefix())
+    validationScript = createValidationScriptAssigment(sampleType, var)
     return """
 %(var)s = tr.getOrCreateNewSampleType(%(code)s)
 %(var)s.setDescription(%(description)s)
@@ -179,6 +190,7 @@ def exportSampleType(sampleType):
 %(var)s.setAutoGeneratedCode(%(isAutoGeneratedCode)s)
 %(var)s.setShowParentMetadata(%(isShowParentMetadata)s)
 %(var)s.setGeneratedCodePrefix(%(generatedCodePrefix)s)
+%(validationScript)s
 """ % vars()
 
 def exportDataSetType(dataSetType):
@@ -189,6 +201,7 @@ def exportDataSetType(dataSetType):
     mainDataSetPattern = dataSetType.getMainDataSetPattern()
     mainDataSetPath = dataSetType.getMainDataSetPath()
     deletionDisallowed = dataSetType.isDeletionDisallowed()
+    validationScript = createValidationScriptAssigment(dataSetType, var)
     if (dataSetType.getCode() in EXISTING_DATASET_TYPES):
         return ""
     else:
@@ -199,6 +212,7 @@ def exportDataSetType(dataSetType):
 %(var)s.setMainDataSetPattern(%(mainDataSetPattern)s)
 %(var)s.setMainDataSetPath(%(mainDataSetPath)s)
 %(var)s.setDeletionDisallowed(%(deletionDisallowed)s)
+%(validationScript)s
 """ % vars()
 
 def exportScripts (script):
@@ -230,9 +244,11 @@ def exportMaterialType(materialType):
     var = getVarName("MATERIAL", materialType.getCode())
     code = codeLiteral(materialType.getCode())
     description = strLiteral(materialType.getDescription())
+    validationScript = createValidationScriptAssigment(materialType, var)
     return """
 %(var)s = tr.getOrCreateNewMaterialType(%(code)s)
 %(var)s.setDescription(%(description)s)
+%(validationScript)s
 """ % vars()
     
 def exportPropertyType(propertyType):
@@ -329,14 +345,14 @@ exportedContent = (
   ["""\nprint "Imported """ + str(len(tr.listFileFormatTypes())) + """ File Formats" """] + 
   [exportVocabulary(vocabulary)   for vocabulary in tr.listVocabularies()] + 
   ["""\nprint "Imported """ + str(len(tr.listVocabularies())) + """ Vocabularies" """] + 
+  [exportScripts(scripts) for scripts in tr.listScripts()] + 
+  ["""\nprint "Imported """ + str(len(tr.listScripts())) + """ Scripts" """] + 
   [exportExperimentType(expType)  for expType in tr.listExperimentTypes()] + 
   ["""\nprint "Imported """ + str(len(tr.listExperimentTypes())) + """ Experiment Types" """] + 
   [exportSampleType(sampleType)   for sampleType in tr.listSampleTypes()] + 
   ["""\nprint "Imported """ + str(len(tr.listSampleTypes())) + """ Sample Types" """] + 
   [exportDataSetType(dataSetType) for dataSetType in tr.listDataSetTypes()] + 
   ["""\nprint "Imported """ + str(len(tr.listDataSetTypes())) + """ Data Set Types" """] + 
-  [exportScripts(scripts) for scripts in tr.listScripts()] + 
-  ["""\nprint "Imported """ + str(len(tr.listScripts())) + """ Scripts" """] + 
   [exportMaterialType(materialType) for materialType in tr.listMaterialTypes()] + 
   ["""\nprint "Imported """ + str(len(tr.listMaterialTypes())) + """ Material Types" """] + 
   [exportPropertyType(propertyType) for propertyType in tr.listPropertyTypes()] +