powershell to the people #suguk
DESCRIPTION
Slide deck from #suguk meeting 24th May 2012. Powershell to the people by @crmckinleyTRANSCRIPT
PowerShell Basics
Cmdlets are in the form verb-noun
Make-coffee
Get-Process
PowerShell Basics
Parameters added after cmdlet
Make-coffee -sugar 2
PowerShell Basics
Pipe your data
Get-Command | where-object {$_.CommandType -like "Alias"}
PowerShell Basics
Variables
$myVariable = “Hello World!”
Some are system such as $error or $_
PowerShell Basics
Loops
Foreach ($object in $collection) {$object}
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
DEMO
Some basics of PowerShell. Out-file, get-command, pipes, loops and variables.
It’s called Windows, not Typies
ISE
Feature on the server
Windows PowerShell Integrated Scripting Environment
• Get-SPFarm
• Get-SPWebApplication
• Get-SPSite
• Get-SPWeb
• Add-SPSolution
SP PS
DEMO
Use of ISE. Getting SharePoint info. Updating site icons, iterating through sites. Creating and removing sites. Getting list items and properties.
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() } }
DEMO
Retrieve farm accounts
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
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