powershell for sharepoint admins
DESCRIPTION
TRANSCRIPT
![Page 1: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/1.jpg)
Rick Taylor
PowerShell for SharePoint Admins
![Page 2: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/2.jpg)
Thank you to Sponsors!
![Page 3: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/3.jpg)
• Who am I???• Who am I ??????????The Guardian of Lost Souls
The Powerful
The PleasurableThe Indestructible
Rick Taylor
Slick Rick – if you’re nasty
![Page 4: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/4.jpg)
• 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
![Page 5: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/5.jpg)
Agenda
• What is Windows PowerShell• Why should you know PowerShell• Windows PowerShell basics • Windows PowerShell scripts for
administrators
![Page 6: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/6.jpg)
• Command-line interface and scripting language used for SharePoint Server administration– Complements CMD– Extends STSADM– Uses XML & Objects– Built on the .Net Framework
What is Windows PowerShell?
![Page 7: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/7.jpg)
• Complete command-line system that is far more powerful than any previous Windows-based command-line prompt environment.
• Provides:– More Control– More Efficiency– More Productivity
Why do we care?
![Page 8: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/8.jpg)
• STSADM still available to support backwards compatibility• Can leverage it in Windows PowerShell scripts
• There are still some things that STSADM can do, that Windows PowerShell cannot, so you still need it!– Ability to run against SQL Snapshots, instead of production.– More granular control for backup / restore.
What about STSADM?
![Page 9: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/9.jpg)
• cmdlet – pronounced "command-let“– More than 500 cmdlets for SharePoint alone
Windows PowerShell Basics
![Page 10: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/10.jpg)
Windows PowerShell Basics• cmdlets = verbs (actions) & nouns (objects)
– Combine the two to build specific commands– Examples
• Get-SPSite• Get = Verb • SPSite = Noun
![Page 11: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/11.jpg)
Windows PowerShell BasicsVerb Operation
Get- Enumerate
New-(static cmdlet)
Create
Set-
Modify
Remove- Delete
![Page 12: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/12.jpg)
• 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
![Page 13: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/13.jpg)
• 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
![Page 14: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/14.jpg)
Differences in Get-help: -full
![Page 15: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/15.jpg)
Differences in Get-help: -detailed
![Page 16: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/16.jpg)
Differences in Get-help: -examples
![Page 17: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/17.jpg)
CHECKING OUT WINDOWS POWERSHELL
DEMO
![Page 18: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/18.jpg)
• Build scripts to easily execute through common commands and tasks
• Develop using PowerShell ISE or other shells• Schedule using Task Scheduler.
PowerShell Scripts
![Page 19: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/19.jpg)
• Examples:– Activate a feature across multiple site collections– Provisioning of Managed Accounts– Creating of New Sites– Backup all Site Collections in Farm
PowerShell Scripts
![Page 20: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/20.jpg)
• Sample Script:$LsaPath = "HKLM:\System\CurrentControlSet\Control\Lsa"$LsaPathValue = Get-ItemProperty -path $LsaPathIf (-not ($LsaPathValue.DisableLoopbackCheck -eq "1")){New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -value "1" -PropertyType dword -Force | Out-Null}
Scripting Syntax
Syntax Description
$ Denotes a variable.
Denotes typing on the same line.
| Sends the output of the preceding cmdlet to the next cmdlet.
If ( ) Evaluate condition in ( ) and execute if true.
![Page 21: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/21.jpg)
WINDOWS POWERSHELL SCRIPTS IN SHAREPOINT
DEMO
![Page 22: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/22.jpg)
Slick Rick’s Picks
![Page 23: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/23.jpg)
SharePoint Community in Philadelphia
• Tri-State SharePoint Users Group– SharePoint (2010 & 2007)
• Administrators• Developers• IT Pros
– Keynote and related Hands-on Lab each meeting– “On SharePoint Development”
• Our lecture series on general SharePoint Development topics and how to improve those skills
– Meetings: 2nd Tuesday of the month, 5:30pm – 9:00pm, Microsoft Malvern MTC
• Website: www.TriStateSharePoint.org• Email: [email protected]• Twitter: @tristateSP
![Page 24: PowerShell for SharePoint Admins](https://reader031.vdocuments.net/reader031/viewer/2022020105/546b267aaf795919088b53f7/html5/thumbnails/24.jpg)
• 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