Powershell script to Backup the SharePoint Site Content Types To XML File

$sourceWeb = Get-SPWeb

#$xmlFilePath = “C:\Install\ScriptDocument.xml”


Function BackupCType()


param ($CTypeName, $xmlFilePath)

#Create Export File

New-Item $xmlFilePath -type file -force

#Export Content Types to XML file

Add-Content $xmlFilePath “<?xml version=`”1.0`” encoding=`”utf-8`”?>”

Add-Content $xmlFilePath “`n<ContentTypes>”

$sourceWeb.ContentTypes | ForEach-Object {

write-host $_.Group

if ($_.Group -eq $CTypeName) {

Add-Content $xmlFilePath $_.SchemaXml



Add-Content $xmlFilePath “</ContentTypes>”





BackupCType “Allied World Content Types” “C:\Install\ScriptDocument.xml”

Leave a Reply

Your email address will not be published. Required fields are marked *