sparked people sparked customers powershell l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Sparked People | Sparked Customers Powershell PowerPoint Presentation
Download Presentation
Sparked People | Sparked Customers Powershell

Loading in 2 Seconds...

play fullscreen
1 / 22

Sparked People | Sparked Customers Powershell - PowerPoint PPT Presentation


  • 163 Views
  • Uploaded on

Sparked People | Sparked Customers Powershell. Agenda. Wat is Powershell Wat betekent Powershell voor Sharepoint Powershell Basics Collecties en objecten , formatting , sorting , filtering , looping , Demo Content Type Publishing Demo configureren timerjobs. En dit ben ik

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Sparked People | Sparked Customers Powershell' - beth


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
agenda
Agenda
  • Wat is Powershell
  • Wat betekent Powershell voor Sharepoint
  • Powershell Basics
    • Collecties en objecten,
    • formatting,
    • sorting,
    • filtering,
    • looping,
  • Demo Content Type Publishing
  • Demo configurerentimerjobs
  • En dit ben ik
  • Sharepoint Solution Architect
  • Teamlead op Microsoft RDP Sharepoint 2010 programma
  • email: Roelhans.bethlehem@sparked.nl
  • Twittter: @rbethleh
  • Blog: www.tsunami.nl
  • Facebook
  • LinkedIn
wat is powershell
Wat is Powershell?

Een shell (command line interpreter)

Verbetering van de command / cmd

Versie 1: release eind 2006

Versie 2: release augustus 2009

integraal onderdeel Windows 7 en Windows Server 2008 R2

Te downloaden voor Windows XP, Windows Server 2003, Windows Vista en Windows Server 2008

Zowel 32 en 64 bits versies

Draait in zijneigenproces (powershell.exe)

wat kan ik met powershell
Wat kan ik met Powershell

VisieMicrosoft: automatiseren van allebeheertaken op het Windows platform:

  • bestandsbeheer,
  • procesbeheer
  • vervangervan traditionele command prompt
  • Vervanger van batch scripting

Beheer Component voor

  • Active Directory
  • Exchange
  • Sharepoint2010

Powershell staat remoting toe

tools
Tools

In Windows

Powershell en Windows 2008 (R2)

Powershell ISE

Externe tools

PowerGui (gratis)

Powershell Plus (Idera)

Powershell Community Extensions

Zie links

sharepoint en powershell
Sharepoint en Powershell

Relevantie voor Sharepoint 2007

Automatisering allerlei taken door Sharepoint 2007 Object Model te refereren

Geen cmdlets voor Sharepoint 2007

Kan zowel Powershell 1 en 2 gebruiken

Relevantie voor Sharepoint 2010

Automatisering allerlei taken door Sharepoint 2010 Object Model te refereren

Native cmdlets (Microsoft.SharePoint.PowerShell)

Vervanger van STSADM in Sharepoint 2010 – STSADM blijft ondersteund

Kan zowel Powershell 1 en 2 gebruiken

Let op: er zijn verschillen in de cmdlets tussen de beta en latere builds in Sharepoint 2010

sharepoint en powershell gebruik
Sharepoint en Powershell - Gebruik

Aanmaken en configureren farm

Aanmaken en configureren sitestructuren (Webapplicaties, sitecollecties, sites)

Configureren service applicaties (bijv. search, metadataservice e.d.)

Rapportage over de configuratie

wat betekent dat nu voor mij
Wat betekent dat nu voor mij?

Developers:

Powershell is een core component voor Sharepoint 2010 – Maak jezelf comfortabel met

Veel concepten sluiten nauw aan bij wat je vanuit C# en VB gewend bent

IT-pro:

Powershell is een belangrijk component in de beheertooling – Maak jezelf comfortabel met

Kennis van Sharepoint Object model is nu vereist (als je meer dan de cmdlets wilt)

Het is handig om kennis van .NET concepten te hebben want allerlei cmdlets retourneren Sharepoint objecten

oh zo veel commando s
Oh zo veel commando’s

De powershell commando’s

Get-Command -PSSnapin Microsoft.SharePoint.PowerShell

Get-Command -PSSnapinMicrosoft.SharePoint.PowerShell | Out-Gridview

Help krijgen

Get-Help get-spfarm –full

Tab completion

Voor commando’s

En voor members

powershell en sharepoint 2010 permissies
Powershell en Sharepoint 2010 permissies

Voor uitvoeren van powershell zijn permissies nodig

Add-SPShellAdmin–Username {domain/username} –Database {contentdbnaam}

Resultaat:

User wordt lid van WSS_ADMIN_WPG groep

ZetSharepoint_Shell_Accessrole in de Sharepointconfiguratie database heeft

CAUTION: foutmeldingen als permissies ontbreken spreekt niet voor zich...

CAUTION: let op execution permission policy bij gedownloade scripts

Restricted - No scripts can be run. Windows PowerShell can be used only in interactive mode.

AllSigned - Only scripts signed by a trusted publisher can be run.

RemoteSigned - Downloaded scripts must be signed by a trusted publisher before they can be run.

Unrestricted - No restrictions; all Windows PowerShell scripts can be run.

powershell basics
Powershell basics

Get-SPServiceInstance Demo

Get-Help Get-SPServiceInstance

Get-SPServiceInstance

Get-SPServiceInstance | select TypeName, status

Pipe + filter

Get-SPServiceInstance | where {$_.Status –eq “Online”}

Sorteren

Get-SPServiceInstance | sort-object TypeName

En combineren

Get-SPServiceInstance | where {$_.Status –eq “Online”} | select TypeName, status | sort-object TypeName

where did my build number go
Where did my build number go?

Vraag op Twitter: Waar is het build nummer van Sharepoint 2010 te zien in de GUI?

GUI:

\

Natuurlijk GUI = Too weak

objecten demo buildversion
Objecten: Demo buildversion

Declareren variable: prefix met dollar teken

$farm = get-spfarm

Get-spfarm retourneert een Microsoft.Sharepoint.Administration.SPFarm object

Retourneren BuildVersion property

write-host $farm.BuildVersion

looping demo spsolution
Looping: Demo SPSolution

Voorbeeld do until loop

function Check-AddStatus([string]$name) {

$counter = [int] 0

do {

$status = get-spsolution | where {$_.Name -eq $name} # query again, not reuse

if ($counter -gt 20) {

Write-Host "Could not add $($_.Name) after 100 seconds" ‘

-ForegroundColor Red

break

}

if ($status -ne $null) { break }

Write-Host "Pausing 5 seconds..."

Start-Sleep -Seconds 5

$counter++

}

until ($status -ne $null)

}

dieper in het sharepoint object model
Dieper in het Sharepoint Object model

We kunnen niet alles met cmdlets aan...

Nieuwe feature van Sharepoint 2010, the Content Type Publishing Hub

Stel je hebt honderden, misschien wel duizenden sitecollecties

Hoe houd je dan je Content Types in sync (velden, policies, templates e.d.)

Subscribe site contenttype aan de Content Publishing Hub

demo content type publishing
Demo content type publishing

function Subscribe-ContentTypes([string]$settingsFile = "servicesettings.xml")

{

[xml]$settings = Get-Content $settingsFile

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") #Call static method

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Administration")

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Taxonomy")

$Thesite = new-object Microsoft.SharePoint.SPSite([string]$settings.ServiceSettings.ContentHub.Url)

$Publisher = new-object Microsoft.SharePoint.Taxonomy.ContentTypeSync.ContentTypePublisher($Thesite)

$types = $Thesite.Rootweb.ContentTypes

$types | ForEach-Object {

if ($_.Group -eq [string]$settings.ServiceSettings.ContentHub.ContentTypeGroup) {

Write-Host "Name: $($_.Name) Group: $($_.Group)"

if ($Publisher.IsPublished($_) -eq $true) {

Write-Host "Already Published: $($Publisher.IsPublished($_))"

}

else {

$Publisher.Publish($_)

Write-Host "Published $($_.Name)"

}

}

}

}

defensief programmeren
Defensief programmeren

Tijdens het uitvoeren van een script wil je weten wat het doet

Start-Transcript en Stop-Transcript

Je wilt wel dat de Stop-Transcript geraakt wordt op het moment dat een fout optreedt

defensief programmeren18
Defensief programmeren

trap [Exception] {

write-host $("TRAPPED: " + $_.Exception.GetType().FullName);

write-host $("TRAPPED: " + $_.Exception.Message);

continue;

}

Start-Transcript -path install-log.txt

Write-Host "Configure search"

Configure-Search

Write-Host "Registering Content Type Hub subscriptions"

Subscribe-ContentTypes

Write-Host "Preparing to create Audiences"

Create-Audiences

Stop-Transcript

optimaliseren development machine
Optimaliseren development machine

Dank aan Jos Verlinde en Ingeborg Struijk van Microsoft

Sharepoint 2010 runt verschillende timerjobs per 30 minuten of minder

Op dev machine weinig noodzaak voor

demo timerjobs
Demo Timerjobs

## Update all fast running (1 minute) timerjobs to run onece every 30+ minutes instead

## Jos Verlinde

## Version 1 - Sharepoint 2010 B2

$Jobs = @(Get-SPTimerJob | Where-Object { $_.Schedule.Interval -le 5 -and $_.Schedule.Description -eq "Minutes" })

if ( $Jobs.count -GT 0 ) {

## Add 30 mintues to all these timerjobs

foreach ($job in $Jobs) {

Write-Host -foregroundcolor green $job.name

$Sched = $job.Schedule

$Sched.Interval= $Sched.Interval+30

$job.Schedule=$Sched

$job.Update()

}

Get-SPTimerJob | Where-Object { $_.Schedule.Description -eq "Minutes" }

} else {

Write-Host -foregroundcolor green "No fast running timerjobs found"

}

links
Links

Getting started:

Free E-book Mastering Powershell – Tobias Weltner: http://powershell.com/cs/blogs/ebook/

Sharepoint Dev Wiki: http://sharepointdevwiki.com/display/public/Getting+started+with+PowerShell+and+SharePoint

Windows PowerShell compiled Help for SharePoint Server 2010

http://www.microsoft.com/downloads/details.aspx?FamilyID=045f7af5-b226-4a05-8ace-4e17cfdef856&displaylang=en

Tools:

http://www.powershellplus.com/

PowerGui: http://powergui.org/index.jspa

Sources:

Powershell Code Repository: http://poshcode.org/

Powershell Community Extensions: http://pscx.codeplex.com/Wikipage

Sharepoint Powershell Rockstars

Gary Lapointe: http://stsadm.blogspot.com/

Zach Rosenfield: http://sharepoint.microsoft.com/blogs/zach/default.aspx