Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rick Toner MCSD, MCPD, MCITP Blog:

Similar presentations


Presentation on theme: "Rick Toner MCSD, MCPD, MCITP Blog:"— Presentation transcript:

1 Rick Toner MCSD, MCPD, MCITP Rick@GetSharePoint.Com Blog: http://www.getsharepoint.com/blog

2 Prior Version of SharePoint  Stsadm and PsConfig  Command line driven text results only

3 SharePoint 2010+  Welcome to Automation!  PowerShell + SharePoint = time savings and validation!

4 What is Windows PowerShell?  Dynamic scripting language  Next generation commandline/scripting environment from Microsoft.  General purpose programming language

5 What can it do?  Automate complex, repetitive tasks  Build command line utilities .NET Interactive Prompt  Windows Server management  SharePoint 2010+  IIS 7.0+

6 Getting Started  How do I get it?  If you're using Windows 7 or Windows Server 2008 R2, you have nothing to do - it's already there.  All other versions can download it at  http://support.microsoft.com/kb/968929

7 Some gotchas!  Adjust PowerShell to allow script execution.  PS> Set-ExecutionPolicy Unrestricted  What if it just won't run?  http://technet.microsoft.com/en- us/library/ee176949.aspx

8 Cmdlets  Standardized naming scheme for cmdlets  - where the verb specifies the action and the noun specifies the object to operate on.  Examples  Get-Help, Remove-Item

9 Scripting Language: Variables  Variables are always prefixed with $ except:  gps -OutVariable Procs –ErrorVariable Err  Set-Variable FirstName 'John'  Can be loosely or strongly typed:  $a = 5  $a = "hi"  [int]$b = 5  $b = "hi" # Errors since $b is type int  $c = [int]"7" # Coerce string to int  Automatic variables  $null, $true, $false, $error, $?, $LastExitCode, $OFS, $MyInvocation

10 Scripting Language: Variables Type of Operation Operators Arithmetic: Numeric + - * / () % Arithmetic: String + to concatenate, * to repeat "-" * 72, -f formatting Assignment = += -= *= /= %= ++ -- Negation ! -not Comparison: General -eq -lt -gt -le -ge -ne -and -or Comparison: String -ceq -clt -cgt -cle -cge -cne -like –notlike -match -notmatch -clike -cnotlike -cmatch -cnotmatch String Manipulation -replace Array -contains -ccontains Bitwise -band -bor -bnot Type test/conversion -is -isnot -as Remember: Many operators start with hyphens “c” indicates case sensitive

11 A better way to script!  PowerGUI Script Editor  Debugging  Variable watch (local window)  Superior scripting UI  Intellisense (Auto complete)  Snippets  Commenting out blocks

12 Other demo scripts and tools!

13 Any good resources?  First and foremost in PowerShell; of course!  PS> Get-Help (Any command)  PS> Get-Help about_Windows_PowerShell_2.0

14 Resources continued Name URL MSDN PS Blogblogs.msdn.com/powershell Technet SP PS Blogtechnet.microsoft.com/en- us/sharepoint/ee518673 Get-PSScriptsget-spscripts.com PowerShell Code Repositoryposhcode.org PowerShell Scripts, Tipspowershell.com

15 Resources continued Name URL PowerGUIpowergui.org Free Powershell Books Effective Windows PowerShellkeithhill.spaces.live.com/blog/cns!5A8D2641E0 963A97!6930.entry Master-PowerShellpowershell.com/cs/blogs/ebook

16 SharePoint PowerShell Books  A++ Book!  Automating SharePoint 2010 with Windows PowerShell 2.0  http://www.wiley.com/Wil eyCDA/WileyTitle/product Cd-0470939206.html http://www.wiley.com/Wil eyCDA/WileyTitle/product Cd-0470939206.html

17 Books continued  PowerShell for Microsoft SharePoint 2010 Administrators  http://www.mhprofessional.c om/product.php?isbn=007174 7974 http://www.mhprofessional.c om/product.php?isbn=007174 7974  PowerShell for SharePoint 2010 How-To  http://www.informit.com/stor e/product.aspx?isbn=0672335 59X http://www.informit.com/stor e/product.aspx?isbn=0672335 59X

18 Questions?  Rick’s blog - http://www.getsharepoint.com/blog email: Rick@GetSharePoint.com Twitter ID: rtonerii  Western Carolina SharePoint Users Group  Arden, March 8 th, 2012 http://www.GetSharePoint.com


Download ppt "Rick Toner MCSD, MCPD, MCITP Blog:"

Similar presentations


Ads by Google