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

4,619 views

Published on

Aula de PowerShell

  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

PowerShell

  1. 1. Sistemas Operacionais II PowerShell
  2. 2. Sobre PowerShell <ul><li>Nova geração de Shell (família Microsoft Windows); </li></ul><ul><li>Permite a execução remota (Versão 2.0); </li></ul><ul><li>Integra com .NET Framework; </li></ul>
  3. 3. Instalação <ul><li>Windows Installer 3.1; </li></ul><ul><li>.NET Framework 2.0 SP 1; </li></ul><ul><li>PowerShell 1.0 (ou 2.0). </li></ul>
  4. 4. Poderosa Calculadora <ul><li>Exemplo: </li></ul><ul><li>5 – 4 </li></ul><ul><li>(5 + 9) * 4 </li></ul><ul><li>5GB / 120MB </li></ul>
  5. 5. Executando Comandos Externos <ul><li>PowerShell pode executar comandos do clássico Prompt de comandos Microsoft, por exemplo ipconfig. </li></ul><ul><ul><li>ipconfig </li></ul></ul><ul><ul><li>ls </li></ul></ul><ul><ul><li>dir </li></ul></ul>
  6. 6. Comandos PowerShell <ul><li>Os comandos internos do PowerShell são chamados de cmdlets. Os nomes dos comandos são compostos por um verbo seguido de - e uma ação. </li></ul><ul><li>Digite no terminal: </li></ul><ul><li>get-command </li></ul>
  7. 7. Auto Explicativo <ul><li>Os comandos PowerShell foram desenvolvidos para exibir explicações sobre os comandos e o comportamento de execução dos mesmos. </li></ul><ul><li>Use o comando: get-help </li></ul>
  8. 8. Uso de Parâmetros <ul><li>Parâmetros adicionam informações aos comandos, tais informações são utilizadas internamente para execução de sua rotina. </li></ul><ul><li>Exemplo: </li></ul><ul><li>Get-ChildItem -path c: </li></ul>
  9. 9. Tipos de Parâmetros <ul><li>Existem parâmetros que necessitam de valores e parâmetros que são apenas usados internamente para execução do algoritmo. </li></ul><ul><li>Get-ChildItem c:windows -recurse -name </li></ul>
  10. 10. Criando Funções <ul><li>A criação de função é simples e intuitiva, veja exemplo abaixo: </li></ul><ul><li>Para criar: </li></ul><ul><li>function quickping { </li></ul><ul><li>ping -n 1 -w 100 $args </li></ul><ul><li>} </li></ul>
  11. 11. Criando Funções <ul><li>Para chamar: </li></ul><ul><li>quickping 127.0.0.1 </li></ul>
  12. 12. Criando um Script <ul><li>Crie um arquivo de texto simples (com notepad) na raiz de C:temp com o nome teste.ps1 e edite o script abaixo: </li></ul><ul><li>“ Isso é um script... Show de bola” </li></ul>
  13. 13. Para executar <ul><li>Primeiro temos que dar permissão: </li></ul><ul><li>Set-ExecutionPolicy RemoteSigned </li></ul><ul><li>Agora executar: </li></ul><ul><li>C:tempteste.ps1 </li></ul>
  14. 14. Alias para scripts <ul><li>Podemos criar um “apelido” para um script. </li></ul><ul><li>Set-Alias meuScript c:tempteste.ps1 </li></ul><ul><li>Para chamar basta escrever no termial: </li></ul><ul><li>meuScript </li></ul>
  15. 15. Variáveis <ul><li>Permite armazenar valores desconhecidos (para a fase de codificação); </li></ul><ul><li>O tipo é definido durante a execução (baseado no valor armazenado); </li></ul><ul><li>Utiliza-se $ para acessar a variável. </li></ul>
  16. 16. Exemplo: <ul><li>$amount = 120 </li></ul><ul><li>$VAT = 0.19 </li></ul><ul><li># Calculate: </li></ul><ul><li>$result = $amount * $VAT </li></ul><ul><li># Output result </li></ul><ul><li>$result </li></ul>
  17. 17. Atribuindo Retorno de Funções <ul><li>Podemos resgatar o retorno de funções me variáveis, exemplo: </li></ul><ul><li>$lista = Get-ChildItem c: </li></ul>
  18. 18. Listando Variáveis <ul><li>Podemos listar as variáveis que estão carregadas na memória, exemplo: </li></ul><ul><li>Dir variable:list* </li></ul>
  19. 19. Testando se uma variável existe <ul><li>Podemos durante a execução validar se uma variável existe para execução de rotinas. </li></ul><ul><li>Test-Path variable:lista </li></ul>
  20. 20. Excluindo uma Variável <ul><li>Podemos excluir variáveis da lista de variáveis e liberar memória. </li></ul><ul><li>del variable:lista </li></ul>
  21. 21. Comandos cmdlets <ul><li>Clear-Variable; </li></ul><ul><li>Get-Variable; </li></ul><ul><li>New-Variable; </li></ul><ul><li>Remove-Variable; </li></ul><ul><li>Set-Variable. </li></ul>
  22. 22. New-Variable <ul><li>New-Variable test -value 100 -description &quot;test variable with write-protection&quot; -option ReadOnly </li></ul>
  23. 23. Variáveis do Ambiente <ul><li>Existem variáveis criadas pelo ambiente que armazenam informações úteis para desenvolver scripts de qualidade. </li></ul><ul><li>Digite: </li></ul><ul><li>Dir env: </li></ul>
  24. 24. Variáveis de Ambiente <ul><li>$env:windir </li></ul><ul><li>$env:OS = &quot;Apple MacIntosh OS X ” </li></ul><ul><li>$env:Teste = “ Reprovar Alunos, teste 1, 2, 3&quot; </li></ul><ul><li>del env:windir </li></ul>
  25. 25. Escopo de Variáveis <ul><li>Variáveis podem ter escopo; </li></ul><ul><li>Escopo define a visibilidade de uma variável; </li></ul><ul><li>Podemos ter: </li></ul><ul><ul><li>global; </li></ul></ul><ul><ul><li>local; </li></ul></ul><ul><ul><li>private; </li></ul></ul><ul><ul><li>script. </li></ul></ul>
  26. 26. Como usar <ul><li>$private:b = 5; </li></ul><ul><li>$local:c = 9; </li></ul><ul><li>$global:d = 3; </li></ul><ul><li>$script:k = 1; </li></ul>
  27. 27. Tipos de Variáveis <ul><li>Para saber o tipo definido para a variável: </li></ul><ul><li>$variavel . GetType() . Name </li></ul>
  28. 28. Definindo um Tipo <ul><li>[Byte]$flag = 12 </li></ul><ul><li>$flag.GetType().Name </li></ul>
  29. 29. DateTime <ul><li>[ datetime ] $date = &quot;November 12, 2004&quot; </li></ul><ul><li>$date </li></ul>
  30. 30. Passando Argumentos para um Script <ul><li>Podemos passar argumentos para um script para execução interna, desta forma podemos chamar scripts dentro de scripts de modo sequencial utilizando os valores gerados. </li></ul>
  31. 31. Argumentos <ul><li>Altere script c:tempteste.ps1 conforme listagem abaixo: </li></ul><ul><li>“ O nome: $args xxxx” </li></ul>
  32. 32. Argumentos <ul><li>Para executar o script: </li></ul><ul><li>meuScript Wellington Pinto de Oliveira </li></ul>
  33. 33. Acesso a um parametro <ul><li>A variável args é uma coleção, para acessar um elemento: </li></ul><ul><li>“ Oxxxx: $($args[0]) uuuu xxxxx ” </li></ul>
  34. 34. Argumentos <ul><li>Para executar o script: </li></ul><ul><li>meuScript Wellington Pinto de Oliveira </li></ul>
  35. 35. Condições <ul><li>Condições são definidas baseando-se em comparações lógicas. </li></ul>
  36. 37. Exemplos <ul><li>4 -eq 10 </li></ul><ul><li>“ wellington ” -eq “ WELLINGTON ” </li></ul><ul><li>12 -eq &quot;Hello&quot; </li></ul><ul><li>12 -eq &quot;000012&quot; </li></ul><ul><li>&quot;12&quot; -eq 12 </li></ul><ul><li>&quot;12&quot; -eq 012 </li></ul><ul><li>&quot;012&quot; -eq 012 </li></ul>
  37. 38. Exemplos <ul><li>123 -lt 123.4 </li></ul><ul><li>123 -lt &quot;123.4&quot; </li></ul><ul><li>123 -lt &quot;123.5&quot; </li></ul>
  38. 39. Condições <ul><li>$a = 10 </li></ul><ul><li>$a -gt 5 </li></ul><ul><li>-not ($a -gt 5) </li></ul><ul><li># Shorthand: instead of -not &quot;!&quot; can also be used: </li></ul><ul><li>!($a -gt 5) </li></ul>
  39. 40. Combinando Condições <ul><li>Podemos combinar condições para criar condições complexas. </li></ul><ul><li>( ($age -ge 18) -and ($sex -eq &quot;m&quot; ) ) </li></ul><ul><li>Usamos operadores especiais, são chamados lógicos. </li></ul>
  40. 42. Comparação com Collections <ul><li>Podemos usar operações de comparação com arrays e collections. </li></ul><ul><li> 1,2,3,4,3,2,1 -eq 3 </li></ul><ul><li>Retorna: </li></ul><ul><li>3 </li></ul><ul><li>3 </li></ul>
  41. 43. Comparação com Collections <ul><li>1,2,3,4,3,2,1 -ne 3 </li></ul><ul><li>Retorna: </li></ul><ul><li>1 , 2, 3, 2, 1 </li></ul>
  42. 44. Validando a Existência de um Elemento <ul><li>Podemos usar para isso o operador -contains </li></ul><ul><li> 1,2,3 -contains 5 </li></ul><ul><li>Retorna: </li></ul><ul><li>False </li></ul>
  43. 45. If-Else <ul><li>Podemos usar a estrutura if-else para executar blocos de scritps baseado no resultado de uma condição condição. </li></ul>
  44. 46. If-Else
  45. 47. Exemplo
  46. 48. Exemplo
  47. 49. Exemplo
  48. 50. switch <ul><li>O Switch permite a comparação de um valor com n possibilidades e inclusive pode-se utilizar operadores relacionais ou lógicos. </li></ul>
  49. 51. Exemplo
  50. 52. Exemplo
  51. 53. Comparação entre Strings
  52. 54. Case Sensitivity
  53. 55. Caractere Curinga
  54. 56. Regex
  55. 57. Loop <ul><li>Um Loop é um laço de repetição que pode ser utilizado para repetir n vezes um bloco de código. </li></ul>
  56. 58. ForEach-Object
  57. 59. Chamando Métodos <ul><li>Get-Process notepad | ForEach-Object </li></ul><ul><li>{ </li></ul><ul><li>$_.Kill() </li></ul><ul><li>} </li></ul>
  58. 60. Exemplo
  59. 61. Foreach
  60. 62. Exemplo
  61. 63. D o...While
  62. 64. While
  63. 65. Saindo de um While
  64. 66. For
  65. 67. Loop com switch
  66. 68. Referência <ul><li>WELTNER, Tobias. Mastering Powershell. </li></ul><ul><li>Disponível em: http:// http://powershell.com/Mastering-PowerShell.pdf </li></ul>

×