Your SlideShare is downloading. ×
0
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Powershell For Developers
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Powershell For Developers

334

Published on

Let’s face it, when was the last time you opened a command prompt as part of your daily routine? Did you know you can save a lot of time by creating scripts that automate your daily tasks, such as …

Let’s face it, when was the last time you opened a command prompt as part of your daily routine? Did you know you can save a lot of time by creating scripts that automate your daily tasks, such as altering your application’s configuration files and then deploy the application to a remote server? There are developers that still think that scripting is the IT department’s domain. But Windows PowerShell is a different story. PowerShell is a scripting language that is more coding than scripting, mostly because its commands return objects, not text.

In this session we will learn what PowerShell is, the basics of coding with it, and how to call it from your .NET code. Most of the session will focus on how developers can benefit from using PowerShell in their day-to-day routine in order to work with XML and JSON, automate deployments, manage certificates, call HTTP services, manipulate file content, and more. Next time you are asked to deploy your application to the server, type, don’t click!

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
334
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Samples
    Work with XML and json
    Cleanup TFS stuff from VS projects
    Generate/use certificates, cert:
    Update configuration files
    Transform text files (lowercase and trim urls for blobs)
    Powershell web access
    Regex tester
    Automatic deployment?
    Call http services?
    Kill a specific w3wp



  • Transcript

    • 1. Ido Flatow PowerShell For Developers
    • 2. About Me • Senior Architect, Sela Group, Israel • Co-author of Microsoft courses – “WCF 4” and “Developing Windows Azure and Web Services” • Co-author, “Pro .NET Performance” and “Pro Single Page Application Development” • Microsoft ASP.NET/IIS MVP • Focus on server, web, cloud, and DevOps • Manager of the Israeli Web Developers User Group
    • 3. What is PowerShell? • A command line interface • A scripting environment • A tool to automate routine tasks • Something that will simplify your life • The next generation of command-line
    • 4. Introducing PowerShell DEMO
    • 5. The Most Important Cmdlets • Get-Help (help) • Get-Command (gcm) • Get-Member (gm)
    • 6. Some Cmdlet Examples Basic functions: • Get-ChildItem (= dir) • Set-Location (= cd) • Copy-Item (= copy) • Remove-Item (= del) Management: • Start-Service • Import-Certificate • Write-EventLog • New-WebAppPool Object treatment: • Where-Object (?) • Select-Object (select) • Foreach-Object (%) • Compare-Object (diff) Layout: • Format-List • ConvertFrom-Json • Out-GridView • ConvertTo-Xml
    • 7. Why is PowerShell so Great? • The output of a command is an object • Objects can be pipelined as input • Built on top of the .NET Framework • Easy to discover what you can do • Has both command-line and GUI • Supports debugging • Runs locally and remotely
    • 8. Piping Examples Get-ChildItem -Filter "*.cs" –File -Recurse | ` Measure-Object Length -Sum ( Get-WmiObject -class win32_process | ` ? {$_.ProcessName -eq 'w3wp.exe'}).GetOwner() | ` Select -property domain, user Get-Process | ? {$_.PrivateMemorySize64 -gt 50MB} | ` Out-Host -Paging
    • 9. PowerShell Pop Quiz Get-EventLog "Application" ` | ? {$_.Source -like 'ASP.NET*' –and ` $_.Message -match 'Event code: (d+).*'} ` | ? {$matches[1] -eq '3005'} ` | foreach { new-object PSObject -prop @{ ` Time = $_.TimeWritten.Date.ToString("yyyy/MM/dd"); Message = ($_.Message | Select-String ` '(Exception message: )(.*)' ).Matches.Groups[2].Value }} ` | group Time, Message ` | select Count, ` @{Name="Time";Expression={$_.Name.Split(",")[0].Trim()}}, ` @{Name="Exception";Expression={$_.Name.Split(",")[1].Trim()}} ` | sort -desc Time ` | out-gridview
    • 10. Tools of the Trade
    • 11. PowerShell Using .NET or .NET Using PowerShell? • You can actually do both! • Call .NET code from PowerShell • Create new C# classes in PowerShell • Execute PowerShell script from .NET
    • 12. PowerShell and .NET Integration DEMO
    • 13. PowerShell For Developers • Work with XML and JSON content • Access system resources, such as registry, files, and certificates • Transform text files using regular expressions • Control platforms, such as IIS, MS-SQL, and Azure • Cleanup TFS content from VS solutions and project • Create automatic deployment scripts • Interact with SOAP and REST services
    • 14. Platform-specific Cmdlets (IIS)
    • 15. Platform-specific Cmdlets (MS-SQL)
    • 16. PowerShell for Developers DEMO
    • 17. Resources Everything PowerShell http://PowerShell.org Script Repository http://www.poshcode.org http://gallery.technet.microsoft.com/scriptcenter Blogs http://blogs.msdn.com/PowerShell http://blogs.technet.com/heyscriptingguy @idoflatow idof@sela.co.il http://blogs.microsoft.co.il/idof
    • 18. Questions
    • 19. Thank You

    ×