Wednesday, 6 April 2011

SP2010–Getting to grips with PowerShell commands

Here are some nice Tips from Niklas Goude for PowerShell commands for SharePoint.

In SharePoint 2010 you can manage sites through Windows PowerShell. You can create new sites in a site collection using the New-SPWeb cmdlet

New-SPWeb http://SP/TeamSite -Template “STS#0” –Name “Team Site” `
-Description “Description of Site” –AddToTopNav –UseParentTopNav

You can retrieve an existing site using the Get-SPWeb cmdlet:

Get-SPWeb http://SP/TeamSite

You can configure a site through the Set-SPWeb cmdlet:

Get-SPWeb http://SP/TeamSite | Set-SPWeb -Description “New Description”

And finally, you can remove a site using the Remove-SPWeb cmdlet:

Remove-SPWeb http://SP/TeamSite -Confirm:$false

Setting the –Confirm switch parameter to $false omits the confirmation returned from PowerShell.

No comments:

Post a Comment

Please include your email address with comments.