PowerShell: (Don't Fear) The Console
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,755
On Slideshare
2,755
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
7
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
  • Eu.Mas antes de mais, show of hands....
  • \\ isusedinpaths, so escape charis `<,> ! ? are usedinscripting, aliases, pipes, sobooleanoperations/comparisons are:andnotgtlt
  • AutomatizarBuildsInstalaçõesProcessos recorrentesPrototiparExplorarDirectoriasBibliotecasSistemas
  • Aqui se calhar abro o visual studio (?)
  • Permite a uma funcção operar sobre cada item em vez de em bulk
  • Modulos são conjuntos de funcionalidadesProviders integram compowershell (para fornecer por ex: iis://)
  • Entre outras coisas, tem :pwd | write-clipboardque é diferente de pwd | out-clipboard

Transcript

  • 1. 24ª Reunião Presencial - 29/10/2011 http://netponto.org (Dont Fear) The Console Bruno Lopes
  • 2. Patrocinadores desta reunião
  • 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. Agenda• What and how• Variables, loops, functions, pipelines, cmdlets• Gotchas and Tips• Extensibility• Extensions
  • 5. Também disponível em vídeo... Assista!http://www.youtube.com/watch?v=k2fL4etnvgA
  • 6. Quem conhece… bash ksh sed ssh ls cat awk vi perl
  • 7. Console
  • 8. Várias inspirações• Javascript• Ruby• Perl• Bash
  • 9. Feito para uso interactivo• Case InSensiTive• Introspeção –get-member –get-help –get-command
  • 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. Para quê? Automatizar Prototipar Explorar
  • 12. Powershell
  • 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. Creating a pipeline functionfunction name { param($a) begin { # initialization } process { #work on param $a } end { # clean-up }}
  • 15. Outras hipoteses• Modules• Providers
  • 16. PSCX• PowerShell Community Extensions –http://pscx.codeplex.com/
  • 17. psakehttps://github.com/JamesKovacs/psaketask Do-Stuff –depends Brilliant-Task ` –description “Do stuff” { Build-Solution Copy-Items binrelease packageoutput.zip }
  • 18. Get-AudienceMembers `| ? { $_.HaveQuestions()) `| % { $speaker.Answer($_.GetQuestions())
  • 19. Patrocinadores desta reunião
  • 20. Obrigado!Bruno Lopesbrunomlopes@gmail.comhttp://www.brunomlopes.comhttp://twitter.com/brunomlopes