SharePoint and Windows PowerShell
Download
Report
Transcript SharePoint and Windows PowerShell
©2012 Microsoft Corporation. All rights reserved.
http://blogs.msdn.com/kaevans
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
http://www.harbar.net/archive/2010/05/03/adding-sharepoint-2010-poweshell-cmdlets-to-your-powershell-ise.aspx
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
6
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
http://www.microsoft.com/resources/TechNet/en-us/Office/media/WindowsPowerShell/WindowsPowerShellCommandBuilder.html
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
11
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
Command
New-SPManagedAccount
New-SPWebApplication
New-SPContentDatabase
New-SPManagedPath
New-SPSite
New-SPWeb
©2012 Microsoft Corporation. All rights reserved.
Description
Registers a new managed account
Creates a new web application
Creates a new content database for a web application
Creates a managed path
Creates a new site collection
Creates a new web within a site collection
©2012 Microsoft Corporation. All rights reserved.
21
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
PS C:\> Add-SPShellAdmin –UserName “contoso\annew”
©2012 Microsoft Corporation. All rights reserved.
Get-SPContentDatabase "WSS_Content_Intranet" | Add-SPShellAdmin
-UserName "contoso\annew"
©2012 Microsoft Corporation. All rights reserved.
25
Farm component Member of Administrators group Member of Farm
on the local computer
Administrators SharePoint
group
Full Control on
backup folder
Farm
Yes
No
Yes
Service application Yes
No
Yes
Content database
Yes
No
Yes
Site collection
No
Yes
Yes
Site, list, document Yes
library
No
Yes
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
27
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
29
Cmdlet Name
Example
Get-SPServiceInstance
$svc = (Get-SPServiceInstance | ? {$_.TypeName -eq "Managed
Metadata Web Service"})
Start-SPServiceInstance
if ($svc.Status –eq "Disabled")
{
$svc | Start-SPServiceInstance
}
while($svc.Status -ne "Online")
{
Write-Host "Waiting to provision";
sleep 5;
}
New-SP*ServiceApplication
PS C:\> Get-Command New-SP*ServiceApplication
New-SP*ServiceApplicationProxy
PS C:\> Get-Command New-SP*ServiceApplicationProxy
New-SPServiceApplicationProxyGroup
Add-SPServiceApplicationProxyGroupMember
New-SPServiceApplicationProxyGroup "Demo"
$mms = Get-SPServiceApplicationProxy | ?{$_.TypeName -eq
"Managed Metadata Service Connection"}
Add-SPServiceApplicationProxyGroupMember -Identity "Demo" Member $mms
©2012 Microsoft Corporation. All rights reserved.
Cmdlet Name
Description
Backup-SPConfigurationDatabase
Backup-SPFarm
Backup-SPSite
Backup a farm, site collection or just the configuration database.
Restore-SPFarm
Restore-SPSite
Restores a farm or site collection.
Test-SPContentDatabase
Tests a content database for issues such as orphaned sites, schema issues, etc.
Add-SPSolution
Install-SPSolution
Uninstall-SPSolution
Remove-SPSolution
Update-SPSolution
Cmdlets equivalent to the STSADM addsolution, deploysolution, retractsolution,
deletesolution, and updatesolution.
Disable-SPFeature
Enable-SPFeature
Deactivates and activates SharePoint Features.
Start-SPTimerJob
Starts a timer job.
Get-SPLogEvent
Returns information about events. Can also accept a correlation ID. The following
example returns back all critical events:
Get-SPLogEvent -MinimumLevel Critical | select Category,
Message | ft -Wrap -AutoSize
New-SPLogFile
Ends the current log file and creates a new one. Useful for debugging issues.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
36
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
Connect-SPOService
–Url https://apps2013demo-admin.sharepoint.com
–credential [email protected]
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.
http://blogs.msdn.com/kaevans
©2012 Microsoft Corporation. All rights reserved.
©2012 Microsoft Corporation. All rights reserved.