{"id":3,"date":"2015-02-10T13:00:30","date_gmt":"2015-02-10T16:00:30","guid":{"rendered":"http:\/\/thesqltimes.com\/blog\/?p=3"},"modified":"2015-02-12T18:28:12","modified_gmt":"2015-02-12T21:28:12","slug":"o-que-e-powershell","status":"publish","type":"post","link":"https:\/\/thesqltimes.com\/blog\/2015\/02\/10\/o-que-e-powershell\/","title":{"rendered":"<img style='width:20px' class='rrg-ti-icon' src=\"https:\/\/thesqltimes.com\/blog\/wp-content\/plugins\/rrg-title-iconizer\/icon_store\/relampago.png\" \/>O que \u00e9 powershell?"},"content":{"rendered":"<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"Muito \u00fatil!\" data-post-id=\"3\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><\/div><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Tempo de Leitura:<\/span> <span class=\"rt-time\"> 2<\/span> <span class=\"rt-label rt-postfix\">minutos<\/span><\/span><p>Lembra do cmd.exe? Prompt de comando, telinha preta, etc. S\u00e3o v\u00e1rios os nomes dados ao Shell padr\u00e3o do Windows.<\/p>\n<p><a href=\"http:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/cmd.exe_.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-488\" src=\"http:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/cmd.exe_.png\" alt=\"cmd.exe\" width=\"668\" height=\"331\" srcset=\"https:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/cmd.exe_.png 668w, https:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/cmd.exe_-300x149.png 300w\" sizes=\"auto, (max-width: 668px) 100vw, 668px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<figure id=\"attachment_491\" aria-describedby=\"caption-attachment-491\" style=\"width: 240px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/posto_shell.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-491 size-full\" src=\"http:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/posto_shell.jpeg\" alt=\"Isto tamb\u00e9m \u00e9 um shell\" width=\"240\" height=\"178\" \/><\/a><figcaption id=\"caption-attachment-491\" class=\"wp-caption-text\">Isto tamb\u00e9m \u00e9 um shell<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">Acredito que a primeira dificuldade em entender o que \u00e9 o powershell \u00e9 entender antes o que \u00e9 um Shell.\u00a0Bom&#8230; Um shell \u00e9 uma interface em que o usu\u00e1rio do sistema operacional pode interagir com os servi\u00e7os oferecidos por ele\u00a0(Fonte: <a title=\"Defini\u00e7\u00e3o de Shell na Wikip\u00e9dia\" href=\"http:\/\/en.wikipedia.org\/wiki\/Shell_%28computing%29\">Wikip\u00e9dia<\/a>). \u00a0Ou seja, voc\u00ea fornece comandos para o shell, e o shell transforma o que voc\u00ea forneceu em chamadas para as fun\u00e7\u00f5es internas do sistema operacional, que vai te dar uma resposta ou fazer alguma opera\u00e7\u00e3o, baseado neste comando. Em poucas palavras e grosseiramente falando, \u00e9 apenas um programa que recebe comandos e chama as fun\u00e7\u00f5es correspondentes da API do sistema operacional, recebe o resultado e transforma em algo mais leg\u00edvel para voc\u00ea, reles humano.<\/p>\n<p><a href=\"http:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/relampago_shell.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-487\" src=\"http:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/relampago_shell-1024x490.png\" alt=\"Um shell\" width=\"1024\" height=\"490\" srcset=\"https:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/relampago_shell-1024x490.png 1024w, https:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/relampago_shell-300x143.png 300w, https:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/relampago_shell.png 1702w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<p>O cmd.exe\u00a0\u00a0era o shell padr\u00e3o. Ele era baseado na mesma interface do antepassado do Windows: o DOS (da\u00ed porque \u00e9 chamado de DOS tamb\u00e9m). Al\u00e9m de permitir usar elementos comuns de linguagens de programa\u00e7\u00e3o, como loops, vari\u00e1veis, voc\u00ea podia usar comandos para listar diret\u00f3rios, obter informa\u00e7\u00f5es de disco, format\u00e1-los, etc.<\/p>\n<p>O powershell \u00e9 a evolu\u00e7\u00e3o do cmd. \u00a0Na minha opini\u00e3o, uma das grandes vantagens do powershell \u00e9 que ele usa todo o .NET como sua base. Voc\u00ea praticamente pode programar em C# na linha de comando.\u00a0Isso te permite construir scripts avan\u00e7ados, que fazem tarefas complexas, com apenas algumas linhas de c\u00f3digo, sem precisar abrir um Visual Studio e compilar algo. Outra grande vantagem \u00e9 o fato de que os resultados dos comandos s\u00e3o retornados como objetos, e n\u00e3o como texto. Isso permite que voc\u00ea manipule mais facilmente o retorno dos comandos, ainda mais quando voc\u00ea precisa passar resultados\u00a0de um comando para outro comando. (O famoso pipe &#8220;|&#8221;). Tamb\u00e9m, o powershell te permite interagir facilmente com o WMI (um servi\u00e7o do Windows que prov\u00ea uma s\u00e9rie de informa\u00e7\u00f5es sobre o Hardware e Software),\u00a0facilita o processo de execu\u00e7\u00e3o de scripts em m\u00e1quinas distintas, e uma s\u00e9rie de outros recursos.<\/p>\n<figure id=\"attachment_489\" aria-describedby=\"caption-attachment-489\" style=\"width: 988px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/powershell.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-489 size-full\" src=\"http:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/powershell.png\" alt=\"A interface padr\u00e3o do powershell. Telinha preta, nunca mais! Ser\u00e1 mesmo!?\" width=\"988\" height=\"631\" srcset=\"https:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/powershell.png 988w, https:\/\/thesqltimes.com\/blog\/wp-content\/uploads\/2015\/02\/powershell-300x192.png 300w\" sizes=\"auto, (max-width: 988px) 100vw, 988px\" \/><\/a><figcaption id=\"caption-attachment-489\" class=\"wp-caption-text\">A interface padr\u00e3o do powershell. Telinha preta, nunca mais! Ser\u00e1 mesmo!?<\/figcaption><\/figure>\n<p>Em breve, mais postagens sobre POWERSHELL!<\/p>\n<p>Iniciando em powershell:<\/p>\n<p><a href=\"http:\/\/abstrys.com\/doku.php\/technology\/powershell\/beginning-powershell-scripting\" target=\"_blank\">http:\/\/abstrys.com\/doku.php\/technology\/powershell\/beginning-powershell-scripting<\/a><\/p>\n<p><a href=\"http:\/\/www.powershellpro.com\/powershell-tutorial-introduction\/\" target=\"_blank\">http:\/\/www.powershellpro.com\/powershell-tutorial-introduction\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lembra do cmd.exe? Prompt de comando, telinha preta, etc. S\u00e3o v\u00e1rios os nomes dados ao Shell padr\u00e3o do Windows. &nbsp; Acredito que a primeira dificuldade em entender o que \u00e9 o powershell \u00e9 entender antes o que \u00e9 um Shell.\u00a0Bom&#8230; Um shell \u00e9 uma interface em que o usu\u00e1rio do sistema operacional pode interagir com&hellip;&nbsp;<a href=\"https:\/\/thesqltimes.com\/blog\/2015\/02\/10\/o-que-e-powershell\/\" rel=\"bookmark\"><span class=\"screen-reader-text\"><img decoding=\"async\" style='width:20px' class='rrg-ti-icon' src=\"https:\/\/thesqltimes.com\/blog\/wp-content\/plugins\/rrg-title-iconizer\/icon_store\/relampago.png\" \/>O que \u00e9 powershell?<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":487,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[95,5,93],"tags":[97,96,98,87],"series":[],"class_list":["post-3","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell-windows","category-relampago","category-windows","tag-dos","tag-powershell","tag-relampago","tag-windows"],"_links":{"self":[{"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/posts\/3","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/comments?post=3"}],"version-history":[{"count":10,"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/posts\/3\/revisions"}],"predecessor-version":[{"id":517,"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/posts\/3\/revisions\/517"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/media\/487"}],"wp:attachment":[{"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/media?parent=3"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/categories?post=3"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/tags?post=3"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/thesqltimes.com\/blog\/wp-json\/wp\/v2\/series?post=3"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}