Managed Metadata extension

Oct 10, 2014 at 3:09 PM
I am struggling to use the Managed Metadata extension. Apparently the problem is in the '-notin' operator which is not supported by Powershell v2. I was convinced that v2 was sufficient to use the script. Is that correct or am I missing something?
Coordinator
Oct 10, 2014 at 8:07 PM
Ooops, my bad! Have been on v3 for too long already.
SPSD itself is PowerShell 2 save, but the extension are all beta and were developed for my own purpose on SharePoint 2013...
I haven't tested them on SP2010 yet.

But there should be an easy fix for it

Just replace -notin with -notcontains and switch the operands.

In https://github.com/rencoreab/SharePoint-Solution-Deployer/blob/master/SPSD.Script.Extensions/ManagedMetadata/Scripts/Extensions/ManagedMetadata/ImportManagedMetadata.ps1 and
https://github.com/rencoreab/SharePoint-Solution-Deployer/blob/master/SPSD.Script.Extensions/ManagedMetadata/Scripts/Extensions/ManagedMetadata/ImportManagedMetadata.ps1

you will find alltogether 10 occurrences of -notin similar to
$_.PrincipalName -notin $xml.TermStore.TermStoreAdministrators.TermStoreAdministrator.InnerText
Change these to
$xml.TermStore.TermStoreAdministrators.TermStoreAdministrator.InnerText -notcontains $_.PrincipalName 
and the others accordingly.

As I don't have a SharePoint 2010 system at my disposal right now I cannot test it myself, so please be so kind and report back if the fix worked, or even better fork the repository and submit a pull request with the change :)

Thanks a lot!
Oct 13, 2014 at 4:04 PM
Ok, I will try and let you know :-)