In SharePoint 2010 Powershell is preferred over stsadm to deploy solutions. Powershell is more flexible than traditional stsadm. In one of my recent projects on SharePoint 2010 I used powershell for deployment. I needed to create a new site collection based on Records Center template. The features were scoped at all levels Farm, Web Application, Site and Web. I created two powershell files for the deployment a Framework.ps1 containing all the powershell functions for deployment and another one called Deployment.ps1 which contained the initialization values and referred the Framework.ps1
Here are the contents of my Framework.ps1 file:
And following are the contents of Deployment.ps1 file. The flow of the deployment is defined in this file.
The Deployment.ps1 starts with by referencing the Framwork.ps1 file. Note that there is a space between two dots at the begining. After that variables are declared. The name of the web application where a site collection is to be created, path of the WSP files, site template type etc. The flow of deployment can be understood by reading the inline comments.
Now comes the actual deployment. Place both the script files in your local folder e.g C:\Scripts and the WSP file in a folder inside Scripts folder e.g; C:\Scripts\WSPs.
Now open SharePoint 2010 Management Shell and move to C directory and then to Scripts folder as shown