Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PowerShell: (Don't Fear) The Console

2,601 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

PowerShell: (Don't Fear) The Console

  1. 1. 24ª Reunião Presencial - 29/10/2011 http://netponto.org (Dont Fear) The Console Bruno Lopes
  2. 2. Patrocinadores desta reunião
  3. 3. Bruno Lopes Scheme Nasci VB Python C C#1980 1985 1990 1995 2000 2005 2010 Primeiro PC Sysadmin/Devel Spectrum weListen Sysadmin/Devel IST Sysadmin/Devel Premium minds
  4. 4. Agenda• What and how• Variables, loops, functions, pipelines, cmdlets• Gotchas and Tips• Extensibility• Extensions
  5. 5. Também disponível em vídeo... Assista!http://www.youtube.com/watch?v=k2fL4etnvgA
  6. 6. Quem conhece… bash ksh sed ssh ls cat awk vi perl
  7. 7. Console
  8. 8. Várias inspirações• Javascript• Ruby• Perl• Bash
  9. 9. Feito para uso interactivo• Case InSensiTive• Introspeção –get-member –get-help –get-command
  10. 10. Administração sem “espigas”• Muitos servers têm bindings de powershell: – IIS – Sql Server – BizTalk – Sharepoint• Se não tiver, finge-se: – Get-WmiObject – Cat <log> | Grep <pattern> | Do-Magic
  11. 11. Para quê? Automatizar Prototipar Explorar
  12. 12. Powershell
  13. 13. Create a cmdlet public class DbUpdateBase : PSCmdlet { protected override void ProcessRecord() { // DO WORK } [Parameter(Mandatory = false)] public string ConfigurationFile { get; set; } [Parameter(Mandatory = true, Position = 0)] public string DeltasDirectory { get; set; } [Parameter(Mandatory = false, HelpMessage = "Defaults to mssql")] public string DatabaseType { get { return _databaseType; } set { _databaseType = value; } }}
  14. 14. Creating a pipeline functionfunction name { param($a) begin { # initialization } process { #work on param $a } end { # clean-up }}
  15. 15. Outras hipoteses• Modules• Providers
  16. 16. PSCX• PowerShell Community Extensions –http://pscx.codeplex.com/
  17. 17. psakehttps://github.com/JamesKovacs/psaketask Do-Stuff –depends Brilliant-Task ` –description “Do stuff” { Build-Solution Copy-Items binrelease packageoutput.zip }
  18. 18. Get-AudienceMembers `| ? { $_.HaveQuestions()) `| % { $speaker.Answer($_.GetQuestions())
  19. 19. Patrocinadores desta reunião
  20. 20. Obrigado!Bruno Lopesbrunomlopes@gmail.comhttp://www.brunomlopes.comhttp://twitter.com/brunomlopes

×