Olá pessoal,
Hoje vamos ver como utilizar o powershell no lugar de uma das ferramentas mais utilizadas quando estamos fazendo troubleshooting de serviços de rede, o netstat.
O netstat exibe as conexões TCP ativas, portas nas quais o computador está ouvindo, estatísticas de Ethernet, tabela de roteamento IP, estatísticas IPv4 (para os protocolos IP, ICMP, TCP e UDP) e estatísticas IPv6 (para os protocolos IPv6, ICMPv6, TCP over IPv6 e UDP sobre protocolos IPv6). Para replicar essa funcionalidade no powershell temos o comando Get-NetTCPConnection, que retorna um resultado semelhante, mas em forma de objetos.
Executando o comando sem quaisquer parâmetros, temos a lista não filtrada de todas as portas que tem conexão ativa. Para listar apenas as portas que o computador esta escutando, podemos utilizar o parâmetro -State com o argumento Listen.
Get-NetTCPConnection -State Listen
Para filtrar mais ainda o resultado, podemos utilizar o parâmetro -LocalPort e enumerar as portas que desejamos filtrar no resultado, caso não localize a porta, ela não será incluida no resultado:
Get-NetTCPConnection -State Listen -LocalPort 22,135,445,443
Este resultado, pode ser ainda mais refinado com os diversos parametros que o comandlet oferece e como está em formato de objeto o resultado pode ser exibido em formato CSV, Excel, exportado para um banco de dados, ou qualquer outra forma de exibição desejada.
Dúvidas? Sugestões? Comente!
Até a próxima!
15 Comments
up
You made some good points there. I looked on the net for additional information about the issue and found most individuals will go along with your views on this website. Kacey Willdon Stefanie
Just go to our Answer Key page. See the tab above this website Allina Noah Ronnica
I blog quite often and I really thank you for your information. The article has truly peaked my interest. I am going to take a note of your website and keep checking for new details about once per week. I opted in for your Feed too. Blisse Erny Menzies
Do you have a spam issue on this website; I also am a blogger, and I was wanting to know your situation; we have developed some nice practices and we are looking to trade techniques with others, be sure to shoot me an e-mail if interested. Allsun Parry Shanahan
Hello, I enjoy reading all of your post. I wanted to write a little comment to support you. Madonna Tristam Mulligan
Suscipit fuga quod unde molestias accusantium praesentium officia asperiores, ipsa itaque. Doloribus ipsum neque nihil magni labore. Voluptates at, temporibus quam eos iure ullam lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam modi laudantium, autem, quasi eligendi possimus suscipit fuga quod unde molestias accusantium praesentium officia asperiores, ipsa itaque. Doloribus ipsum neque nihil magni labore. Voluptates at, temporibus quam eos iure ullam lorem ipsum dolor sit amet, consectetur adipisicing elit. Eaque repellendus dolores nemo deleniti quaerat dicta delectus odit a perspiciatis similique necessitatibus, reiciendis possimus fugiat dolorem! Raynell Barde Parnas
Dead composed content , thanks for information . Gaynor Rouvin Jerrold
Thanks for the diverse tips contributed on this blog. I have noticed that many insurance providers offer shoppers generous reductions if they favor to insure a few cars with them. A significant variety of households own several autos these days, in particular those with more aged teenage kids still located at home, as well as the savings with policies may soon increase. So it will pay to look for a great deal. Stacee Krisha Marci
Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Ophelia Sayres Nadia
I used to be able to find good info from your blog posts. Phyllis Mortimer Cantone
Thank you for the sensible critique. Me & my neighbor were just preparing to do some research on this. We got a grab a book from our local library but I think I learned more clear from this post. I am very glad to see such wonderful info being shared freely out there. Batsheva Dominik Clein
I think you have remarked some very interesting points , appreciate it for the post. Marquita Kahlil Crescentia
Some truly prime articles on this web site , bookmarked. Arly Shepherd Haddad Cornie Nico Ellen
One never needs their humor as much a when they argue with a fool.