Recently, I ran into a circumstance in which trying to Save as Site Template using the browser did not work for me. It just hung and never finished. So, I started looking for how to do it with PowerShell (SharePoint Management Shell). As it turned out, it’s very simple

$Web=Get-SPWeb http://YourServername/YourSite
$Web.SaveAsTemplate("Your Template Name","Your Template Title","Your Description",0)

The zero at the end saves the template without data. If you do by chance want to save it with the data, just change the zero to ‘1’.