For some reasons when retrieving the ID of a content type at the list level in PowerShell, the ID of the parent content type (i.e. the one at the site level) is always returned.
Below is my script:
$web = Get-SPWeb http://myServer $list = $web.Lists.TryGetList("My List") $contentType = $list.ContentTypes["My Content Type"] $contentType.ID
Running the above script would give me:
Notice the property being displayed is Parent. I have no idea why it is doing this.
To get around this, I get the content type ID from its SchemaXml property by changing the script to be:
$web = Get-SPWeb http://myServer $list = $web.Lists.TryGetList("My List") $contentType = $list.ContentTypes["My Content Type"] [xml] $contentTypeXml = $contentType.SchemaXml $contentTypeXml.ContentType.ID
This then gives the expected result as below:
This behaviour was observed on SP2013 without any PU or CU applied.
Awesome post. Same is happening in SP2010. Very confusing. Thanks for pointing this out.