‘WARNING: Template is not found and is not applied’ when using custom WebTemplate with PowerShell

WebTemplate is the new way of doing site definitions in SP2010 (see this for a good overview: http://sharepointchick.com/archive/0001/01/01/site-definitions-vs.-webtemplates.aspx).

Where you need to refer to the custom WebTemplate, you’d use the ‘{FeatureID}#WebTemplateName’ syntax, e.g:


I however have found that this does not work with the PowerShell New-SPWeb cmdlet (when used with the -Template parameter). You’d get the error message: WARNING: Template is not found and is not applied.

To get around this, call the New-SPWeb without the -Template parameter. Then call ApplyWebTemplate on the resulting object. E.g.:

$web = New-SPWeb $url …



About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in PowerShell, SharePoint 2010, WebTemplate. Bookmark the permalink.

4 Responses to ‘WARNING: Template is not found and is not applied’ when using custom WebTemplate with PowerShell

  1. John Johnson says:

    This did not work for me I get the error:

    PS C:\sptemp> $web.ApplyWebTemplate($template.Name)
    Exception calling “ApplyWebTemplate” with “1” argument(s): “A site template has
    already been applied to this site. Once a template has been applied, the site
    must be deleted and recreated in order to apply a different template.”
    At line:1 char:22
    + $web.ApplyWebTemplate <<<< ($template.Name)
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

    • Bernado says:

      Hiya, I am assuming you are calling this in a 2-steps process as described in this post? If so, can you try running the 1st step first, then browse to the site, do you then get the pick a template to apply page? This will test that a template has not already applied to your site.

  2. Nathalie says:

    Hey! I also have this problem. I need to apply my template ID to many different sites in my PowerShell script. But it doesen’t work. I’ve tried to do as in your post. I took away -template parameter from new SP-Web. And my sites are created. Should I add this :

    $web = New-SPWeb $url …


    Should I add that to my script or should i do a new script, I’ve tried both but i don’t get it to work.
    So my question really is, Where to put the “code” and do I write it wrong (syntax).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s