16

Powershell to the People #suguk

Embed Size (px)

DESCRIPTION

Slide deck from #suguk meeting 24th May 2012. Powershell to the people by @crmckinley

Citation preview

Page 1: Powershell to the People #suguk
Page 2: Powershell to the People #suguk

About Chris McKinley

@crmckinley

[email protected]

Page 3: Powershell to the People #suguk

PowerShell Basics

Cmdlets are in the form verb-noun

Make-coffee

Get-Process

Page 4: Powershell to the People #suguk

PowerShell Basics

Parameters added after cmdlet

Make-coffee -sugar 2

Page 5: Powershell to the People #suguk

PowerShell Basics

Pipe your data

Get-Command | where-object {$_.CommandType -like "Alias"}

Page 6: Powershell to the People #suguk

PowerShell Basics

Variables

$myVariable = “Hello World!”

Some are system such as $error or $_

Page 7: Powershell to the People #suguk

PowerShell Basics

Loops

Foreach ($object in $collection) {$object}

Page 8: Powershell to the People #suguk

Not all things are equal

Just watch out for –eq –gt –lt

They are not the same as = > <

Operator Description -eq Equal to

-lt Less than

-gt Greater than

-ge Greater than or Eqaul to

-le Less than or equal to

-ne Not equal to

Page 9: Powershell to the People #suguk

DEMO

Some basics of PowerShell. Out-file, get-command, pipes, loops and variables.

Page 10: Powershell to the People #suguk

It’s called Windows, not Typies

ISE

Feature on the server

Windows PowerShell Integrated Scripting Environment

Page 11: Powershell to the People #suguk

• Get-SPFarm

• Get-SPWebApplication

• Get-SPSite

• Get-SPWeb

• Add-SPSolution

SP PS

Page 12: Powershell to the People #suguk

DEMO

Use of ISE. Getting SharePoint info. Updating site icons, iterating through sites. Creating and removing sites. Getting list items and properties.

Page 13: Powershell to the People #suguk

Nah, just Bing it.

• Do you really know what that script is doing?

$web = Get-SPWeb "http://mywebapp/somesite/stuff" foreach ($i in $web.Lists) { if($i.Description = "My Test Calendar") { $i.Delete() } }

Page 14: Powershell to the People #suguk

DEMO

Retrieve farm accounts

Page 15: Powershell to the People #suguk

Any Questions?

Resources • Guy Thomas MVP

– http://www.computerperformance.co.uk/powershell/

• Retrieve Farm Accounts – http://www.sharepointlonghorn.com/Lists/Posts/Post.aspx?ID=11

@crmckinley

[email protected]

Page 16: Powershell to the People #suguk

One last thing…

• Submit an idea for a custom SharePoint 2010 web part and you are in with a chance of us building it for you for free!

• http://www.SharePointEduTech.com

• http://tinyurl.com/spetwp