PowerShell Code Snippets for SharePoint2010 Developers

Posted by ybbest on YBBest See other posts from YBBest or by ybbest
Published on Thu, 24 Feb 2011 09:14:45 +0000 Indexed on 2011/02/24 15:34 UTC
Read the original article Hit count: 707

Filed under:
|
|

Install solution to SharePoint Farm and activate Feature to a site collection

#Please specify the solution package path.

$SolutionPackagePath = “C:\ybbest\myForm.xsn”

Add-SPSolution -LiteralPath $SolutionPackagePath

#Please specify the site collection url.

$SiteCollectionUrl=”http:// ybbest /”

# Install the solution package to the SharePoint Farm

Install-SPSolution -Identity ybbest.wsp -GACDeployment

#Activate features in the solution package to a Site Collection

Enable-SPFeature -Identity 8ed800a2-3494-4cba-adf1-ed8714cb062d -Url $SiteCollectionUrl

Retract solution from SharePoint Farm and deactivate Feature to a site collection

#Deactivate features from a Site Collection

Disable-SPFeature -Identity 8ed800a2-3494-4cba-adf1-ed8714cb062d -Url http:// ybbest /

# Uninstall the solution package to the SharePoint Farm

Uninstall-SPSolution -Identity ybbest.wsp

# Remove the solution package to the SharePoint Farm

Remove-SPSolution -Identity ybbest.wsp

Install Admin Approved InfoPath form

#Please specify the template path.

$InfopathFormTemplatePath = “C:\ybbest\myForm.xsn”

#Please specify the site collection url.

$SiteCollectionUrl=”http:// ybbest /”

#Install InfoPath to the SharePoint Farm

$formTemplate=Install-SPInfoPathFormTemplate -Path $InfopathFormTemplatePath

#Activate InfoPath form to Site Collection

Enable-SPInfoPathFormTemplate -Identity $formTemplate -Site $SiteCollectionUrl

References

http://technet.microsoft.com/en-us/library/ee806878.aspx

http://www.wssdemo.com/Lists/PowerShell/Commands.aspx


© YBBest or respective owner

Related posts about ITPRO

Related posts about powershell