Your SlideShare is downloading. ×

PowerShell for sharepoint 2010 administrators

3,170
views

Published on

PowerShell for sharepoint 2010 administrators. This session was done at SharePoint Saturday India Online event

PowerShell for sharepoint 2010 administrators. This session was done at SharePoint Saturday India Online event

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
3,170
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
106
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Getting Started with PowerShell for SharePoint 2010 administrators Ravikanth Chaganti
  • 2. About me • A lead engineer at Dell and a Windows PowerShell MVP • Developer of – PSCodePlex – PSRemoteFileExplorer – Remote File Explorer PowerPack – BITS File Transfer PowerPack – PSSPUtils – PS SharePoint 2010 Utils on Codeplex • Author of – Free eBook - Layman’s guide to PowerShell 2.0 remoting – SharePoint 2010 PowerShell Cheat sheet (powerGui.org) – Several others in pipe http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 3. Agenda • Part 1: Introduction to PowerShell • Part 2: Introduction to PowerShell for SharePoint 2010 • Q & A http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 4. Why PowerShell? • Understand with an example: – Calculate the size of a folder http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth DOS Batch PowerShell @echo off setLocal EnableDelayedExpansion set /a value=0 set /a sum=0 FOR /R %1 %%I IN (*) DO ( set /a value=%%~zI/1024 set /a sum=!sum!+!value! ) @echo Size is: !sum! k $size=0;gci C:scripts -rec | % { $Size+=$_.Length};$size/1KB
  • 5. PowerShell Console http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 6. PowerShell ISE http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth Tab Completion Extensible object model Built-in debugger Color coded syntax
  • 7. PowerShell Cmdlets  Pronounced as command-let  A lightweight command  an instance of .NET framework classes  Use verb-noun pairs ◦ Get-Verb to list all approved verbs http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 8. Discover PowerShell • Master these cmdlets – Get-Command – Get-Help – Get-Member • About_Topics; example: – Get-Help about_variables – Get-Help about_Operators http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 9. PowerShell for SharePoint • Replaces STSADM for command-line management – STSADM still ships for backward compatibility • 500+ PowerShell cmdlets – Programs -> Microsoft SharePoint 2010 Products -> SharePoint 2010 management Shell – Add-PSSnapin Microsoft.SharePoint.PowerShell • Cmdlets have SP noun prefix – Get-Command –Noun SP* http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 10. PowerShell can do more • More than what central administration can do • Examples – Backup using SQL snapshots – Configuring RBS – Configuring request throttling – Several others http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 11. Things to know: Permissions • Must have SharePoint_Shell_Access role on SharePoint databases (both content & configuration) • Must be a member of WSS_ADMIN_WPG local group on all farm servers • Use Add-SPShellAdmin to give a user above permissions http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 12. Things to know: Object Disposal • Some cmdlets return huge objects and take up large amount of memory • Objects get disposed at the end of pipeline – Not true for objects stored in a variable • Use a built-in cmdlet as far as possible – Get-SPWeb –Identity http://sp2010demo | Set-SPWeb –Description “This is my demo site” http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 13. Things to know: Object Disposal • Use Dispose() when not using built-in cmdlets • SharePoint 2010 provides cmdlets to workaround this – Start-SpAssignment – Stop-SPAssignment – Objects get associated to an assignment store and get disposed when Stop-Assignment is called http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 14. Things to know: Execution Policy • By default, PowerShell does not allow scripts to run • Change policy with Set-ExecutionPoilicy • Policy Settings – Restricted (default) – scripts will not execute – Unrestricted – scripts can execute. Unsigned scripts will prompt user to execute – Bypass (developer mode) – scripts can execute, no user prompting to execute http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 15. • PowerShell Console • PowerShell ISE • PowerGUI AdminConsole • PowerGUI ScriptEditor • PowerWF • PowerShell Plus Tools for the job
  • 16. Books & Resources • PowerShell for Microsoft SharePoint 2010 Administrators – By Niklas Goude & Mattias Karlsson • SharePoint 2010 PowerShell cmdlets cheat sheet – PowerGUI.Org • PowerShell in action, 2nd edition – Bruce Payette • Windows management framework (PowerShell v2) download for Windows Server 2008, Vista, XP and Windows 2003 – http://support.microsoft.com/kb/968929 http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth
  • 17. Q & A http://ravichaganti.com/blog Ravikanth@Ravichaganti.com @ravikanth