I need to create a subsite with Custom template, so I imported and activated my custom template into site collection, Then I added my subsite into Subsites can only use the following site templates using PowerShell scripts, So My template adds as(TestTemplate(US)). Then I tried to create subsite using

Add-PSSnapin Microsoft.Sharepoint.Powershell
$web = get-spweb http://sitecollection
$template = $web.GetAvailableWebTemplates(1033) | Where-Object {$_.Title -eq "{B4A1F080-2595-48C9-9325-A0C40B5C2068}#FinanceTemplate"}
$newweb = New-SPWeb -Url "http://Test2" 

while executing the scripts it throws a null value exception for ApplyWebTemplate, at same time subsite created but my custom template not applied.I checked the Title of the custom template it's also same. It' working fine when we creating in UI.Please suggest some idea achieve this

1 Answer 1


Try it as below:

$newweb = New-SPWeb -Url "http://Test2" -Template "{B4A1F080-2595-48C9-9325-A0C40B5C2068}#FinanceTemplate"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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