{"id":1205,"date":"2015-06-18T08:21:09","date_gmt":"2015-06-18T11:21:09","guid":{"rendered":"http:\/\/www.franklinjr.com\/blog\/?p=1205"},"modified":"2015-06-18T08:22:29","modified_gmt":"2015-06-18T11:22:29","slug":"pegar-requisicoes-do-momento-no-windows-2012-em-powershell","status":"publish","type":"post","link":"https:\/\/www.franklinjr.com\/blog\/index.php\/2015\/06\/18\/pegar-requisicoes-do-momento-no-windows-2012-em-powershell\/","title":{"rendered":"Pegar requisi\u00e7\u00f5es do momento no Windows 2012 em PowerShell"},"content":{"rendered":"<pre lang=\"powershell\" line=\"1\"> \r\n$wp = Get-WmiObject WorkerProcess -Namespace root\/WebAdministration\r\n\r\nforeach($w in $wp){\r\n    $w | Invoke-WmiMethod -Name GetExecutingRequests |\r\n    Select-Object -ExpandProperty OutputElement | Foreach-Object{\r\n        [PSCustomObject]@{\r\n            nomePool = $w.AppPoolName\r\n            PID = $w.ProcessId\r\n            ipOrigem = $_.ClientIPAddress\r\n            modulo = $_.CurrentModule\r\n\t    idConexao = $_.ConnectionId\r\n            porta = $_.LocalPort\r\n            siteId = $_.SiteId\r\n            url = $_.Url\r\n            verbo = $_.Verb\r\n            tempoEmSegundos = $_.TimeInState \/ 1000\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>\u00c9 poss\u00edvel filtrar para um determinado PID ou pool de aplicativo, por exemplo, alterando a primeira linha para alguma coisa do tipo<\/p>\n<pre lang=\"powershell\" line=\"1\"> \r\n$wp = Get-WmiObject WorkerProcess -Namespace root\/WebAdministration -Filter \"ProcessId=%PID%\"\r\n<\/pre>\n<pre lang=\"powershell\" line=\"1\"> \r\n$wp = Get-WmiObject WorkerProcess -Namespace root\/WebAdministration -Filter \"AppPoolName='%nomeDaPool%'\"\r\n<\/pre>\n<p>Refer\u00eancia: <a href=\"http:\/\/www.powershellmagazine.com\/2014\/03\/18\/pstip-get-requests-that-are-currently-executing-in-a-worker-process\/\" target=\"_blank\">Get requests that are currently executing in a worker process<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>$wp = Get-WmiObject WorkerProcess -Namespace root\/WebAdministration foreach($w in $wp){ $w | Invoke-WmiMethod -Name GetExecutingRequests | Select-Object -ExpandProperty OutputElement | Foreach-Object{ [PSCustomObject]@{ nomePool = $w.AppPoolName PID = $w.ProcessId ipOrigem = $_.ClientIPAddress modulo = $_.CurrentModule idConexao = $_.ConnectionId porta = $_.LocalPort siteId = $_.SiteId url = $_.Url verbo = $_.Verb tempoEmSegundos = $_.TimeInState \/ 1000 } } [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[553],"tags":[530,554,555],"class_list":["post-1205","post","type-post","status-publish","format-standard","hentry","category-power-shell","tag-iis8","tag-power-shell","tag-windows-2012"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>Pegar requisi\u00e7\u00f5es do momento no Windows 2012 em PowerShell - Franklin Jr.<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.franklinjr.com\/blog\/index.php\/2015\/06\/18\/pegar-requisicoes-do-momento-no-windows-2012-em-powershell\/\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.franklinjr.com\\\/blog\\\/index.php\\\/2015\\\/06\\\/18\\\/pegar-requisicoes-do-momento-no-windows-2012-em-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\\\/\\\/www.franklinjr.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pegar requisi\u00e7\u00f5es do momento no Windows 2012 em PowerShell\"}]}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pegar requisi\u00e7\u00f5es do momento no Windows 2012 em PowerShell - Franklin Jr.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.franklinjr.com\/blog\/index.php\/2015\/06\/18\/pegar-requisicoes-do-momento-no-windows-2012-em-powershell\/","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"https:\/\/www.franklinjr.com\/blog\/index.php\/2015\/06\/18\/pegar-requisicoes-do-momento-no-windows-2012-em-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/www.franklinjr.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Pegar requisi\u00e7\u00f5es do momento no Windows 2012 em PowerShell"}]}]}},"_links":{"self":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=1205"}],"version-history":[{"count":4,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1205\/revisions"}],"predecessor-version":[{"id":1210,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/1205\/revisions\/1210"}],"wp:attachment":[{"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=1205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=1205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.franklinjr.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=1205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}