Power shell for sp admins
-
Upload
rick-taylor -
Category
Technology
-
view
1.896 -
download
2
description
Transcript of Power shell for sp admins
TITLE HERE:Title
Rick Taylor
PowerShell for SharePoint Admins
Who Am I?
• Who am I???• Who am I ??????????The Guardian of Lost Souls
The PowerfulThe PleasurableThe Indestructible
Rick Taylor
Slick Rick – if you’re nasty
• Rick Taylor, MCSE, MCT
– [email protected]– SharePoint architect, formerly with Microsoft
SharePoint Platform Architecture Team for SharePoint Online
– Contact• http://blogs.technet.com/ritaylor• Twitter: @SLKRCK
• What is Windows PowerShell • Windows PowerShell basics • Windows PowerShell scripts for SharePoint
administrators
Agenda
• Command-line interface and scripting language used for SharePoint Server administration– Complements CMD– Extends STSADM– Built on the .Net Framework
What is Windows PowerShell?
• Tool of choice for administering SharePoint from the command line.
• Provides:– More Control– More Efficiency– More Productivity
• Better, Stronger, Faster…
Why do we care?
• STSADM still available to support backwards compatibility
• Can leverage it in Windows PowerShell scripts• Whatever STSADM can do, Windows PowerShell can
do better!– More granular control for backup / restore.– Deploy Features in one fell swoop
What about STSADM?
• cmdlet – pronounced "command-let“
– single function that can be used separately or combined with other cmdlets to perform complex tasks and automate administration
Windows PowerShell Basics
Windows PowerShell Basics
• cmdlets = verbs (actions) & nouns (objects)– Combine the two to build specific commands– Examples
• Get-SPSite• Get = Verb • SPSite = Noun
• Get a list of all commands:– Get-Command –noun sp*
• Get help for a specific command:– Get-Help <cmdlet>
Getting the list of SharePoint cmdlets
• For more detailed help add the following parameters:
– Get-Help <cmdlet> -full
– Get-Help <cmdlet> -examples
– Get-Help <cmdlet> -detailed
Getting the list of SharePoint cmdlets
CHECKING OUT WINDOWS POWERSHELL
DEMO
• Build scripts to easily execute through common commands and tasks
• Develop using PowerShell ISE or other shells• Schedule using Task Scheduler.
PowerShell Scripts
• Examples:– Activate a feature across multiple site collections– Provisioning of Managed Accounts– Creating of New Sites– Backup all Site Collections in Farm
PowerShell Scripts
• Sample Script:– $password = Read-Host "What is the password for
all accounts?" -assecurestring ; Get-Content usernames.txt | ForEach-Object {New-SPManagedAccount -password $password -username warrior\$_; Set-SPManagedAccount -identity $_ -autogenerate -confirm:$False}
Scripting Syntax
Syntax Description
$ Denotes a variable.
; Denotes completion of cmdlet, continue to next one.
| Sends the output of the preceding cmdlet to the next cmdlet.
ForEach-Object { } For each object, execute all the commands within the { }.
THE 11 MOST USEFUL SHAREPOINT POWERSHELL CMDLETS
DEMO
18
Top 11 Most Useful SharePoint PowerShell Cmdlets
1. Get-help2. Get-command3. Get-SPSite/SPWeb4. Move-SPSite5. Import-SPWeb6. Backup-SP*7. Restore-SP*8. New-SP*9. Remove-SP*10. Install-SPFeature/SPSolution11. Enable-SPFeature/TimerJob
• Windows PowerShell for SharePoint Foundation 2010– http://
technet.microsoft.com/en-us/library/ee662510(office.14).aspx
• Windows PowerShell Getting Started Guide– http://msdn.microsoft.com/en-us/library/aa973757(VS.85).
aspx
• Windows PowerShell Cheat Sheet– http://refcardz.dzone.com/refcardz/windows-powershell
• STSADM to Windows PowerShell mapping– http://technet.microsoft.com/en-us/library/ff621084.aspx
• Zach Rosenfield’s blog– http://sharepoint.microsoft.com/blogs/zach/default.aspx
Additional PowerShell Resources
Slide Title Here
Verdana 16 or 14 pt bold
Verdana 14 or 12 pt
Stock photography images are available for use here:
https://wiki.perficient.com/confluence/display/mktg/Stock+Images