SlideShare a Scribd company logo
Using Windows PowerShell v2.0 Eric Kraus  [Microsoft] [email_address] http://blogs.msdn.com/ekraus Twitter/  @erickraus AND DEVELOPMENT!
Introduction What is PowerShell? Variables, Operators, and Syntax, Oh my! Cmdlets?  Functions?  or  Methods?
LoadAssembly[“Microsoft.SharePoint”] Advanced Functions Additional Resources Questions
 
What is PowerShell? How is it different than cmd.exe? What different things can I do with PowerShell? Why PowerShell?
Built on .NET “ White Box Scripting” Great IDE (“ISE”) .NET Cmdlets (Visual Studio) Blue Background
Creating Variables $var = “something” Instantiating Objects $var = new-object System.DateTime(2009,3,14) Instance vs. Static Methods $var.ToString()  [System.DateTime]::Now Loading Assemblies [System.Reflection.Assembly]::   LoadWithPartialName(“Microsoft.SharePoint”)
Create Aliases Set-Alias  -name “stsadm”    -value  “c:\program files……\stsadm.exe” Piping Get-Process  |  format-table Get-Process  | ft
For-Each foreach  OR  | % Get-Process | foreach {Write-Host $_.Name} Get-Process  | % {Write-Host $_.Name} Format-Table Get-Process | ft Where-Object where  OR  | ? Get-Process | where {$_.Name –like “*explore*”} Get-Process  | ? {$_.Name –like “*explore*”} Out-GridView Get-Process | Out-GridView Export-CSV Get-Process | Export-CSV –Path c:\processes.csv
Get-Alias Get-ChildItem Get-Date Get-EventLog Get-Help Get-Process Get-Service Set-Alias Set-Location Write-Host Stop-Process Stop-Service New-Object ForEach-Object Where-Object
Get-Alias [gal] Get-ChildItem [dir] Get-Date Get-EventLog Get-Help Get-Process [gps] Get-Service [gsv] Set-Alias [sal] Set-Location [cd] Write-Host [write] Stop-Process [spps] Stop-Service [spsv] New-Object ForEach-Object [%] Where-Object [?]
Set Variables and Aliases $SPHome= "${env:CommonProgramFiles}\Microsoft Shared\web server extensions\12\“ Set-Alias –name “stsadm”    –value “$SPHome\bin\stsadm.exe” Load SharePoint Assemblies [System.Reflection.Assembly]:: LoadFrom(“$SPHome\ISAPI\Microsoft.SharePoint.dll”)
Get-SPSite [-url] Get-SPWeb [-url] Get-SPEventLog  [-limit  5] Get-SPSolutions  [-name <>] Get-SPUsersInEnterpriseSites Dispose-SPSite
Create Module Features Create-ModuleFiles  [-outputLocation] Reset IIS, Warm Up SharePoint RestartAndWarmUp-SharePoint Site Collection Backup Backup-SPSite [-url, -outputLocation]
[CmdletBinding()] $host ShouldProcess() ParameterSetName Write-Progress Nested Prompt Get-SPSite [–url, -explore]
$profile Import-Module  SPoshMod ScriptBlock $str = “write-host ‘This is a string’” $scriptBlock =  $ExecutionContext.InvokeCommand.NewScriptBlock($str) Invoke-Command  $scriptBlock Get-History
http://blogs.msdn.com/sharepoint http://blogs.msdn.com/powershell http:// sharepoint.microsoft.com/blogs/zach http://blogs.msdn.com/ekraus http://www.poshcode.org  [Steven Murawski, Hal Rottenberg, Darin Pendergraft] http://www.codeplex.com/SPoshMod http://www.nivot.org  [Oisin Grehan] http://www.ilovesharepoint.com  [Christian Glessner]
 

More Related Content

What's hot (20)

PPTX
Event-driven IO server-side JavaScript environment based on V8 Engine
Ricardo Silva
 
PPTX
Dockercompose
Rory Preddy
 
PDF
XWiki: The best wiki for developers
Vincent Massol
 
PPTX
A Beginner's Guide to Building Data Pipelines with Luigi
Growth Intelligence
 
PDF
CouchDB Mobile - From Couch to 5K in 1 Hour
Peter Friese
 
PDF
Terraforming the Kubernetes Land
Radek Simko
 
PDF
Ali Asad Lotia (DevOps at Beamly) - Riemann Stream Processing at #DOXLON
Outlyer
 
ODP
Introducing CouchDB
Hatem Ben Yacoub
 
PDF
VMUGIT UC 2013 - 07c Veeam
VMUG IT
 
PDF
Building data flows with Celery and SQLAlchemy
Roger Barnes
 
PPTX
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Docker, Inc.
 
PDF
iOS VoIP待ち受けの仕組み
typester
 
PPTX
Client-side Rendering with AngularJS
David Lapsley
 
PPTX
Dev Jumpstart: Build Your First App with MongoDB
MongoDB
 
PPTX
20141001 delapsley-oc-openstack-final
David Lapsley
 
PDF
David Fetter, Disqus
Ontico
 
PPTX
SORACOM Beam から AWS IoT へのデータ送信
Motokatsu Matsui
 
PDF
Everybody Loves AFNetworking ... and So Can you!
jeffsoto
 
PDF
Neo4j: Import and Data Modelling
Neo4j
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Ricardo Silva
 
Dockercompose
Rory Preddy
 
XWiki: The best wiki for developers
Vincent Massol
 
A Beginner's Guide to Building Data Pipelines with Luigi
Growth Intelligence
 
CouchDB Mobile - From Couch to 5K in 1 Hour
Peter Friese
 
Terraforming the Kubernetes Land
Radek Simko
 
Ali Asad Lotia (DevOps at Beamly) - Riemann Stream Processing at #DOXLON
Outlyer
 
Introducing CouchDB
Hatem Ben Yacoub
 
VMUGIT UC 2013 - 07c Veeam
VMUG IT
 
Building data flows with Celery and SQLAlchemy
Roger Barnes
 
Dockerizing Windows Server Applications by Ender Barillas and Taylor Brown
Docker, Inc.
 
iOS VoIP待ち受けの仕組み
typester
 
Client-side Rendering with AngularJS
David Lapsley
 
Dev Jumpstart: Build Your First App with MongoDB
MongoDB
 
20141001 delapsley-oc-openstack-final
David Lapsley
 
David Fetter, Disqus
Ontico
 
SORACOM Beam から AWS IoT へのデータ送信
Motokatsu Matsui
 
Everybody Loves AFNetworking ... and So Can you!
jeffsoto
 
Neo4j: Import and Data Modelling
Neo4j
 

Viewers also liked (7)

PDF
SharePoint logging & debugging
Sentri
 
PPTX
Using Powershell to manage SharePoint
Craig Pilkenton
 
PDF
SharePoint Performance at SPS Philly
Sentri
 
PPTX
Sentri Webinar: Windows Azure Overview
Sentri
 
PDF
Le filament magazine 31 de juillet et aout 2013
Patrice Piardon
 
PDF
SystemCenter webinar 12 6 12
Sentri
 
PDF
Heavy Metal PowerPivot Remastered - Experts Conference
Sentri
 
SharePoint logging & debugging
Sentri
 
Using Powershell to manage SharePoint
Craig Pilkenton
 
SharePoint Performance at SPS Philly
Sentri
 
Sentri Webinar: Windows Azure Overview
Sentri
 
Le filament magazine 31 de juillet et aout 2013
Patrice Piardon
 
SystemCenter webinar 12 6 12
Sentri
 
Heavy Metal PowerPivot Remastered - Experts Conference
Sentri
 
Ad

Similar to SharePoint Administration with PowerShell (20)

PDF
Operacion Guinda 2
Red RADAR
 
PPTX
Intro to SharePoint + PowerShell
Ryan Dennis
 
PDF
Introduction to PowerShell
Boulos Dib
 
PPTX
Introduction to windows power shell in sharepoint 2010
Binh Nguyen
 
PPT
Powershell Seminar @ ITWorx CuttingEdge Club
Essam Salah
 
PPT
NIIT ISAS Q5 Report - Windows PowerShell
Phan Hien
 
PPTX
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
PPTX
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
PPTX
Powershell Tech Ed2009
rsnarayanan
 
TXT
An a z index of windows power shell commandss
Ben Pope
 
PPTX
PowerShell 101
Thomas Lee
 
PPTX
Introduction to powershell
Salaudeen Rajack
 
PPTX
Getting Started With PowerShell Scripting
Ravikanth Chaganti
 
PDF
PowerShell_LangRef_v3 (1).pdf
outcast96
 
PPTX
Intro to PowerShell
Adam Preston
 
PDF
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Hitesh Mohapatra
 
PPTX
Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...
Michael Blumenthal (Microsoft MVP)
 
PPTX
PowerShell-1
Saravanan G
 
PPTX
SVCC 5 introduction to powershell
qawarrior
 
PPTX
PowerShell for SharePoint Admins
Rick Taylor
 
Operacion Guinda 2
Red RADAR
 
Intro to SharePoint + PowerShell
Ryan Dennis
 
Introduction to PowerShell
Boulos Dib
 
Introduction to windows power shell in sharepoint 2010
Binh Nguyen
 
Powershell Seminar @ ITWorx CuttingEdge Club
Essam Salah
 
NIIT ISAS Q5 Report - Windows PowerShell
Phan Hien
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
SharePoint Saturday NY
 
Powershell Tech Ed2009
rsnarayanan
 
An a z index of windows power shell commandss
Ben Pope
 
PowerShell 101
Thomas Lee
 
Introduction to powershell
Salaudeen Rajack
 
Getting Started With PowerShell Scripting
Ravikanth Chaganti
 
PowerShell_LangRef_v3 (1).pdf
outcast96
 
Intro to PowerShell
Adam Preston
 
Basic commands for powershell : Configuring Windows PowerShell and working wi...
Hitesh Mohapatra
 
Introduction to PowerShell for SharePoint Admins and Developers - SharePoint ...
Michael Blumenthal (Microsoft MVP)
 
PowerShell-1
Saravanan G
 
SVCC 5 introduction to powershell
qawarrior
 
PowerShell for SharePoint Admins
Rick Taylor
 
Ad

Recently uploaded (20)

PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PPTX
The birth and death of Stars - earth and life science
rizellemarieastrolo
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PPTX
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PPTX
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PPTX
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PDF
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PDF
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
Next level data operations using Power Automate magic
Andries den Haan
 
PDF
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
The birth and death of Stars - earth and life science
rizellemarieastrolo
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
Next level data operations using Power Automate magic
Andries den Haan
 
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 

SharePoint Administration with PowerShell

  • 1. Using Windows PowerShell v2.0 Eric Kraus [Microsoft] [email_address] http://blogs.msdn.com/ekraus Twitter/ @erickraus AND DEVELOPMENT!
  • 2. Introduction What is PowerShell? Variables, Operators, and Syntax, Oh my! Cmdlets? Functions? or Methods?
  • 4.  
  • 5. What is PowerShell? How is it different than cmd.exe? What different things can I do with PowerShell? Why PowerShell?
  • 6. Built on .NET “ White Box Scripting” Great IDE (“ISE”) .NET Cmdlets (Visual Studio) Blue Background
  • 7. Creating Variables $var = “something” Instantiating Objects $var = new-object System.DateTime(2009,3,14) Instance vs. Static Methods $var.ToString() [System.DateTime]::Now Loading Assemblies [System.Reflection.Assembly]:: LoadWithPartialName(“Microsoft.SharePoint”)
  • 8. Create Aliases Set-Alias -name “stsadm” -value “c:\program files……\stsadm.exe” Piping Get-Process | format-table Get-Process | ft
  • 9. For-Each foreach OR | % Get-Process | foreach {Write-Host $_.Name} Get-Process | % {Write-Host $_.Name} Format-Table Get-Process | ft Where-Object where OR | ? Get-Process | where {$_.Name –like “*explore*”} Get-Process | ? {$_.Name –like “*explore*”} Out-GridView Get-Process | Out-GridView Export-CSV Get-Process | Export-CSV –Path c:\processes.csv
  • 10. Get-Alias Get-ChildItem Get-Date Get-EventLog Get-Help Get-Process Get-Service Set-Alias Set-Location Write-Host Stop-Process Stop-Service New-Object ForEach-Object Where-Object
  • 11. Get-Alias [gal] Get-ChildItem [dir] Get-Date Get-EventLog Get-Help Get-Process [gps] Get-Service [gsv] Set-Alias [sal] Set-Location [cd] Write-Host [write] Stop-Process [spps] Stop-Service [spsv] New-Object ForEach-Object [%] Where-Object [?]
  • 12. Set Variables and Aliases $SPHome= &quot;${env:CommonProgramFiles}\Microsoft Shared\web server extensions\12\“ Set-Alias –name “stsadm” –value “$SPHome\bin\stsadm.exe” Load SharePoint Assemblies [System.Reflection.Assembly]:: LoadFrom(“$SPHome\ISAPI\Microsoft.SharePoint.dll”)
  • 13. Get-SPSite [-url] Get-SPWeb [-url] Get-SPEventLog [-limit 5] Get-SPSolutions [-name <>] Get-SPUsersInEnterpriseSites Dispose-SPSite
  • 14. Create Module Features Create-ModuleFiles [-outputLocation] Reset IIS, Warm Up SharePoint RestartAndWarmUp-SharePoint Site Collection Backup Backup-SPSite [-url, -outputLocation]
  • 15. [CmdletBinding()] $host ShouldProcess() ParameterSetName Write-Progress Nested Prompt Get-SPSite [–url, -explore]
  • 16. $profile Import-Module SPoshMod ScriptBlock $str = “write-host ‘This is a string’” $scriptBlock = $ExecutionContext.InvokeCommand.NewScriptBlock($str) Invoke-Command $scriptBlock Get-History
  • 17. http://blogs.msdn.com/sharepoint http://blogs.msdn.com/powershell http:// sharepoint.microsoft.com/blogs/zach http://blogs.msdn.com/ekraus http://www.poshcode.org [Steven Murawski, Hal Rottenberg, Darin Pendergraft] http://www.codeplex.com/SPoshMod http://www.nivot.org [Oisin Grehan] http://www.ilovesharepoint.com [Christian Glessner]
  • 18.