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"
$newweb.ApplyWebTemplate($template.Name)
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