Site Definition not available from Powershell
-
10-12-2019 - |
Question
Using SP 2013.
I have created a site definition in Visual Studio 2012.
Deployed that as a solution.
From the UI I can create a site and select the template I created.
However when I go into PowerShell and call GetAvailableTemplates
on the root web, its not there?
For the site I created (from my site def) I go into PowerShell and get SPWeb.WebTemplate
which is empty, SPWeb.WebTemplateID
contains the ID, which in my case in 10001
If I use SharePoint Manager that does actually show the name of the template. Weird.
If I go into Page Layouts and Site Settings, set to only use my Site Template (which is obviously in the list) ... going back to PowerShell and calling GetAvailableWebTemplates()
returns nothing...
I've read that it could be down to caching, but I don't think that affects Powershell ... i did an IIS reset anyway.
Solution
Well, after restarting SQL, IIS nothing seemed to help. So I restarted the box and bingo.
Powershell is finding my template.
Love SharePoint!
OTHER TIPS
Have specifically you tried the following:
get-spwebtemplate
That command should return back all of the globally installed site templates.
get-spwebtemplate "STS*"
That command returns specific details for the team site templates. And you can do other filters like that for the other "types" of templates.