tcp - How can I automate Telnet port checking in Powershell?` -


I am currently trying to put together script which asks AD for computer list still Active, and then all the pingable computers on all pingable computers, the output I am looking for in a specific port is a complete list of Pingable computers in AD, for which I said that Telnet can not be made in port.

I have read, but those who are trying to do 'I' just want to see that Telnet connection can be successful without entering Telnet (or automatic to leave Telnet) and Proceed to the next machine to test. My script's advertising and ping-parts are set, I'm settled here. Whatever I tried, he did not do much work in a planned manner.

The code for the first part of the script is, if necessary: ​​

  Get-ADComputer - Filter * - Searchbase 'DC = Haha, DC = isHey' | $ {Computer name = $ _ Name $ copies = @ {computer name = $ computerName alive = $ incorrect PortOpen = $ false} (test-connection -captainname $ computer name -Type 1-cool) {$ props.Alive = $ true}  Net.Sockets.TcpClient . $ {Foreach ($ Port in $ ports) • # for open TCP ports, net to use for #quotation;  
  foreach ($ ComputerName in ComputerName) $ {foreach ($ Port in $ ports) Sockets. $ Socket = new object net Sockets. QP Client # Error Message $ Error ActionPressPrincess = 'Silently' Continuum '# $ Try to Connect Socket. Connect $ ($ computer, $ port) # Error message visible again View $ errorExchange Prefix = 'Continue' # Set if we are connected ($ socket. Connected) {"$ {computer}: Port $ port Open "$ socket. Closed ()} and {"$ {computer}: port port is closed or filtered"} # apparently reset the middle variable iterations are required $ socket = $ tap}}    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -