Deleting managed metadata term stores using powershell script. Was trying with the below script but getting error "Cannot index into null array". Please help out thanks in advance....
Add-PSSnapin Microsoft.SharePoint.Powershell
Clear-Host
$taxonomySite = get-SPSite "http://"
$mmsServiceName = "Managed Metadata Service"
#$taxonomySite = Get-SPSite $centralAdminURL
$taxSession = Get-SPTaxonomySession -Site $taxonomySite
$termStore = $taxSession.TermStores[$config.configuration.configSettings.mmsServiceName]
$grpName = "XXX"
$grpManager = ""
$termSetName = ""
$termSetOwner = ""
$tsStakeHolder = ""
Clear-Host
$group = $termStore.Groups["XXX"]
if ($contentsource -ne $null)
{
$contentsource.Delete()
}
if ($termStore -ne $null)
{
if ($group -ne $null)
{
$group.TermSets|foreach{
$_.Delete()
$termStore.CommitAll()
}
$group.Delete()
$termStore.CommitAll()
}
}