SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found this article which does a very good job explaining how to add built in web parts (like the content editor webpart). Unfortunately when I tried to add my own I couldn't get it to work. I have the webpart already installed on my sharepoint instance, I have checked the GAC and confirmed that the assembly for my webpart is there, but when I try to run this line:

$webpart = New-Object HighlightsTicker.HighlightsTickerPart.HighlightsTickerPart

I get the error:

New-Object : Cannot find type [HighlightsTicker.HighlightsTickerPart.HighlightsTickerPart]: make sure the assembly containing this type is loaded. At C:\Users\amiessler\AppData\Local\Temp\3\8c524086-dcea-4250-a4b9-0722c51e3d8f.ps1:5 char:22 + $webpart = New-Object <<<< HighlightsTicker.HighlightsTickerPart.HighlightsTickerPart + CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

This is what the code for my HightlightsTickerPart.cs looks like namespace/classname wise:

namespace HighlightsTicker.HighlightsTickerPart
    public class HighlightsTickerPart : WebPart

Do I need to do something differently to get this to work with a custom webpart?

share|improve this question
up vote 2 down vote accepted

You may need to load the assembly containing the web part in your PowerShell Session, if you have not done so already. See below:

I think LoadWithPartialName is the way to go in this case.

share|improve this answer
I ended up using Load Looks like LoadWithPartialName has been deprecated. Ended up looking like this: [reflection.assembly]::Load("HighlightsTicker, Version=, Culture=neutral, PublicKeyToken=ccdee482b415afe7") – Abe Miessler Dec 15 '11 at 16:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.