{"id":8841,"date":"2012-07-02T00:01:00","date_gmt":"2012-07-02T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2012\/07\/02\/use-powershell-for-network-host-and-port-discovery-sweeps\/"},"modified":"2012-07-02T00:01:00","modified_gmt":"2012-07-02T00:01:00","slug":"use-powershell-for-network-host-and-port-discovery-sweeps","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/use-powershell-for-network-host-and-port-discovery-sweeps\/","title":{"rendered":"Use PowerShell for Network Host and Port Discovery Sweeps"},"content":{"rendered":"<p><b>Summary<\/b>: Guest blogger, Niklas Goude, discusses using Windows PowerShell to perform ping sweeps and port scans on a connected network.\nMicrosoft Scripting Guy, Ed Wilson, is here. This week we have guest blogger Niklas Goude. Before we get to Niklas, I want to mention that you should mark your calendars for September 15, 2012 because that is the date that the second Windows PowerShell Saturday event occurs. It will be held in Charlotte, North Carolina. Attendance is limited, so keep your ears attuned for when registration opens. We will have three tracks and the event will be a lot of fun.<\/p>\n<p style=\"padding-left: 30px\">Niklas Goude is a Security Consultant at TrueSec and an MVP in Windows PowerShell. In addition to his work performing security assessments for a variety of clients, he also has extensive experience in using Windows PowerShell to automate and implement Windows environments. He has been speaking at TechDays; SharePoint conferences in the U.S., Australia, and New Zealand; and other events and conferences. He is the author of two books about Windows PowerShell, and he shares his knowledge at <a href=\"http:\/\/www.powershell.nu\/\" target=\"_blank\">PowerShell.nu<\/a>. He is a member of the TrueSec Expert Team, an independent, elite team of security and infrastructure consultants that operates all over the world. The security team at TrueSec performs various tasks and services related to IT security such as code review, security health checks, and penetration testing. TrueSec also delivers top-notch training sessions in advanced IT security. Check out the <a href=\"http:\/\/www.truesec.com\/\" target=\"_blank\">TruSec<\/a> website for additional information.\nNow, without further ado, here is Niklas&hellip;\nPenetration testing is an important part of improving security in any network environment. A hacker usually only needs to find very few weaknesses (even only one) to compromise important IT systems. An important task for an IT administrator is to identify potential weaknesses and mitigate them.\nThis is the first blog in a weekly series of five where we will talk about basic penetration testing techniques and how they affect misconfigured systems. The series will cover everything from initial network reconnaissance techniques and brute force attacks to advanced extraction of registry secrets to assess dangerous system dependencies.\nThe key learning point is to demonstrate how you can use Windows PowerShell to accomplish almost any task no matter the subject. The secondary learning point is to make you aware of common security issues and misconfigurations that may occur in Microsoft infrastructures today. One important thing to keep in mind is that the vulnerabilities we are looking for exist simply because of misconfigurations made by administrators, such as weak passwords, system dependencies, misconfigurations, and more. I hope you will learn and enjoy!<\/p>\n<p style=\"padding-left: 30px\"><b>Note<\/b>&nbsp;&nbsp;&nbsp;Today&rsquo;s blog discusses using Windows PowerShell to perform network discovery. On some networks, use of such techniques is expressly disallowed except for specifically authorized teams and individuals. You must ensure that you have permission to perform the techniques described here prior to using such techniques at work. This also is a good time to emphasize the importance of proper network security configuration. For help with security configuration of your computer, see the <a href=\"http:\/\/www.microsoft.com\/security\/default.aspx\" target=\"_blank\">Microsoft Safety &amp; Security Center<\/a>.<\/p>\n<h2>Part&nbsp;1: Scanning<\/h2>\n<p>Scanning for IP addresses, MAC addresses, host names, and open ports is a way of finding the available computers on a network and finding out which service each computer publishes. In this blog, we will talk about how this can be performed by using Windows PowerShell.<\/p>\n<h3>Scenario<\/h3>\n<p>This scenario is based on a Windows domain environment that consists of three machines:<\/p>\n<ul>\n<li>DC01: domain controller<\/li>\n<li>SRV01: SQL Server and IIS<\/li>\n<li>SP01: SharePoint 2010, SQL Server, and IIS<\/li>\n<\/ul>\n<p>In addition, we have a client on the same network as the domain; however, the client is not a member of the domain. Each command in this scenario is executed from the client.<\/p>\n<h3>Configuration<\/h3>\n<p>The servers are manually installed by using the default settings. The servers use the Windows Firewalls default settings. The recommended internal firewall design is described in the following Microsoft TechNet Security Bulletin: <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/cc700827.aspx\" target=\"_blank\">Internal Firewall Design<\/a>.<\/p>\n<h3>Code<\/h3>\n<p>The first step in scanning the network for IP addresses, host names, and open ports is to determine which network we are currently sitting on. The simplest way to do this is to use <b>ipconfig<\/b>. As you already know, Windows PowerShell has full support for running executables.\nSimply type <b>ipconfig<\/b> to find out which network you are on. If you are running Windows PowerShell&nbsp;3.0, you can also use the new <b>Get-NetIPAddress<\/b> cmdLlet.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; ipconfig<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">Windows IP Configuration<\/p>\n<p style=\"padding-left: 30px\">Ethernet adapter Wired Ethernet Connection 2:<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp;Connection-specific DNS Suffix . :<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp;Link-local IPv6 Address . . . . . : fe81::3314:cf47:dbc2:935c%11<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp;IPv4 Address. . . . . . . . . . . : 10.0.0.100<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp;Subnet Mask . . . . . . . . . . . : 255.0.0.0<\/p>\n<p style=\"padding-left: 30px\">&nbsp;&nbsp;Default Gateway . . . . . . . . . : 10.0.0.1\nThis example tells us that our IP address is 10.0.0.100 and the subnet is 255.0.0.0. With this information, we can perform a ping sweep on the network to find out if any hosts are reachable. We could, of course, achieve this by using ping.exe. However, there are more efficient ways to perform ping sweeps in a Windows network by using Windows PowerShell. One way is to use the <b>Test-Connection<\/b> cmdlet, which returns a <b>Win32_PingStatus<\/b> object that we can investigate in Windows PowerShell. We can also create an instance of System.Net.Networkinformation.Ping by using the <b>New-Object<\/b> cmdlet. This is the approach we&rsquo;ll focus on. The following example demonstrates how to create an instance of System.Net.Networkinformation.Ping.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $ping = New-Object System.Net.Networkinformation.ping\nThe <b>Ping<\/b> class supports a method called <b>Send()<\/b>, which we can use to send an Internet Control Message Protocol (ICMP) echo request to a computer by simply specifying an IP address. The following example demonstrates how to send an ICMP echo request to 10.0.0.2.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $ping.Send(&#8220;10.0.0.2&#8221;)<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">Status&nbsp;&nbsp;&nbsp; : Success<\/p>\n<p style=\"padding-left: 30px\">Address&nbsp;&nbsp; &nbsp;: 10.0.0.2<\/p>\n<p style=\"padding-left: 30px\">RoundtripTime : 0<\/p>\n<p style=\"padding-left: 30px\">Options&nbsp;&nbsp; &nbsp;: System.Net.NetworkInformation.PingOptions<\/p>\n<p style=\"padding-left: 30px\">Buffer&nbsp;&nbsp;&nbsp; : {97, 98, 99, 100&#8230;}\nIf the computer responds, the status property is set to Success as shown in this example. It&rsquo;s also possible to add a timeout by using a different overload definition. The timeout specifies the maximum number of milliseconds to wait for the ICMP echo reply message. The following example demonstrates how to ping 10.0.0.10 and wait for 500 milliseconds.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $ping.Send(&#8220;10.0.0.10&#8221;, 500)<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">Status&nbsp;&nbsp;&nbsp; : TimedOut<\/p>\n<p style=\"padding-left: 30px\">Address&nbsp;&nbsp; &nbsp;:<\/p>\n<p style=\"padding-left: 30px\">RoundtripTime : 0<\/p>\n<p style=\"padding-left: 30px\">Options&nbsp;&nbsp; &nbsp;:<\/p>\n<p style=\"padding-left: 30px\">Buffer&nbsp;&nbsp;&nbsp; : {}\nIf we wanted to perform a ping sweep on multiple computers, we could simply take advantage of the Windows PowerShell pipeline support, and pipe any number of given IP addresses to the <b>Send()<\/b> method.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; &#8220;10.0.0.2&#8221;,&#8221;10.0.0.3&#8243; | ForEach-Object { $ping.Send($_, 500) }<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">Status&nbsp;&nbsp;&nbsp; : Success<\/p>\n<p style=\"padding-left: 30px\">Address&nbsp;&nbsp; &nbsp;: 10.0.0.2<\/p>\n<p style=\"padding-left: 30px\">RoundtripTime : 0<\/p>\n<p style=\"padding-left: 30px\">Options&nbsp;&nbsp; &nbsp;: System.Net.NetworkInformation.PingOptions<\/p>\n<p style=\"padding-left: 30px\">Buffer&nbsp;&nbsp;&nbsp; : {97, 98, 99, 100&#8230;}<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">Status&nbsp;&nbsp;&nbsp; : Success<\/p>\n<p style=\"padding-left: 30px\">Address&nbsp;&nbsp; &nbsp;: 10.0.0.3<\/p>\n<p style=\"padding-left: 30px\">RoundtripTime : 0<\/p>\n<p style=\"padding-left: 30px\">Options&nbsp;&nbsp; &nbsp;: System.Net.NetworkInformation.PingOptions<\/p>\n<p style=\"padding-left: 30px\">Buffer&nbsp;&nbsp;&nbsp; : {97, 98, 99, 100&#8230;}\nNow that we know how to perform a simple ping sweep by using Windows PowerShell, let&rsquo;s take a look at how to use Windows PowerShell to resolve a host name.\nThe <b>System.Net.DNS<\/b> class contains a static method, <b>GetHostEntry()<\/b>, which we can use to ask the DNS server for the host name that is associated with a given IP address.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; [Net.DNS]::GetHostEntry(&#8220;10.0.0.3&#8221;)<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">HostName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Aliases&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddressList&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<\/p>\n<p style=\"padding-left: 30px\">&#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&#8212;&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8212;&#8212;&#8211;&nbsp; <br \/> SRV01.hacme.local&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{10.0.0.3}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/p>\n<p style=\"padding-left: 30px\">SRV01.hacme.local&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{10.0.0.3\nIt is also possible to ask the DNS server for the host name <b>Async<\/b> by using the <b>BeginGetHostEntry() <\/b>and the <b>EndGetHostEntry()<\/b> methods that are supported by <b>System.Net.DNS<\/b>.\nNext, let us look at how to determine which ports are open on a system. The <b>System.Net.Sockets.TcpClient<\/b> class supports the <b>Connect()<\/b> method, which we can use to connect to a given IP address and port. First we create an instance to <b>System.Net.Sockets.TcpClient<\/b>.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $tcpClient = New-Object System.Net.Sockets.TCPClient\nNext, we use the <b>Connect()<\/b> method and try to connect to a specific IP address and port. In the following example, we test if port 445 is open. Port 445 is the SMB port. If the connection is successful, the <b>Connected<\/b> property is set to True as shown here:<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $tcpClient = New-Object System.Net.Sockets.TCPClient<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $tcpClient.Connect(&#8220;10.0.0.2&#8221;,445)<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $tcpClient.Connected<\/p>\n<p style=\"padding-left: 30px\">True\nIf the connection fails, an error message is displayed and the <b>Connected<\/b> property is False.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $tcpClient.Connect(&#8220;10.0.0.2&#8221;,1234)<\/p>\n<p style=\"padding-left: 30px\">Exception calling &#8220;Connect&#8221; with &#8220;2&#8221; argument(s):<\/p>\n<p style=\"padding-left: 30px\">&#8220;A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.0.0.2:1234&#8221;<\/p>\n<p style=\"padding-left: 30px\">At line:1 char:1+ $tcpClient.Connect(&#8220;10.0.0.2&#8221;,1234)<\/p>\n<p style=\"padding-left: 30px\">+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<\/p>\n<p style=\"padding-left: 30px\">&nbsp; + CategoryInfo&nbsp;&nbsp;&nbsp;&nbsp; : NotSpecified: (:) [], MethodInvocationException<\/p>\n<p style=\"padding-left: 30px\">&nbsp; + FullyQualifiedErrorId : SocketException<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $tcpClient.Connected<\/p>\n<p style=\"padding-left: 30px\">False\nIt is also possible to test the port&rsquo;s Async by using the <b>BeginConnect()<\/b> method.\nThese are the basic steps that we need to perform a network scan by using Windows PowerShell. The nice thing about Windows PowerShell is that we can reuse the code by placing it in a function and simply calling the function instead of typing the code every time we want to perform a network scan.\nThe following example demonstrates the <b>Invoke-TSPingSweep<\/b> function in action.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; Invoke-TSPingSweep -StartAddress 10.0.0.1 -EndAddress 10.0.0.10 -ResolveHost -ScanPort<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">IPAddress&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;HostName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;Ports&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<\/p>\n<p style=\"padding-left: 30px\">&#8212;&#8212;&#8212;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<\/p>\n<p style=\"padding-left: 30px\">10.0.0.2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DC01.hacme.local&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{53, 139, 389, 445&#8230;}&nbsp;<\/p>\n<p style=\"padding-left: 30px\">10.0.0.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SRV01.hacme.local&nbsp;&nbsp;&nbsp;&nbsp; {21, 80, 139, 445&#8230;}<\/p>\n<p style=\"padding-left: 30px\">10.0.0.10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;SP01.hacme.local&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{80, 139, 445}&nbsp;&nbsp; &nbsp;\nThe function uses the code described in this post and supports the following parameters:<\/p>\n<ul>\n<li>StartAddress<\/li>\n<li>EndAddress<\/li>\n<li>ResolveHost<\/li>\n<li>ScanPort<\/li>\n<li>Ports<\/li>\n<li>Timeout<\/li>\n<\/ul>\n<p>Using the functionality of Windows PowerShell makes it very easy to search for specific ports that are returned from a network scan to determine if a computer is running a specific service. For example, if we wanted to find all computers running SQL Server, we could simply store the output in a variable and use the <b>Where-Object<\/b> cmdlet to retrieve each object where the Port 1433 is open.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $pingSweep = Invoke-TSPingSweep -StartAddress 10.0.0.1 -EndAddress 10.0.0.10 -ResolveHost -ScanPort<\/p>\n<p style=\"padding-left: 30px\"> PS &gt; $pingSweep | Where-Object { $_.Ports -eq &#8220;1433&#8221; }<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">IPAddress&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;HostName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;Ports&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<\/p>\n<p style=\"padding-left: 30px\">&#8212;&#8212;&#8212;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<\/p>\n<p style=\"padding-left: 30px\">10.0.0.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SRV01.hacme.local&nbsp;&nbsp;&nbsp;&nbsp; {21, 80, 139, 445&#8230;}<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $pingSweep | Where-Object { $_.Ports -eq 80 }<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">IPAddress&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;HostName&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ports&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<\/p>\n<p style=\"padding-left: 30px\">&#8212;&#8212;&#8212;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&#8212;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&#8212;&#8211;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<\/p>\n<p style=\"padding-left: 30px\">10.0.0.3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SRV01.localdomain&nbsp;&nbsp;&nbsp;&nbsp; {21, 80, 139, 445&#8230;} &nbsp;<\/p>\n<p style=\"padding-left: 30px\">10.0.0.10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;SP01.localdomain&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{80, 139, 445}&nbsp;\nThere are, of course, other tools that you can use when performing network scans. One such tool is the <b>Nmap<\/b> security scanner, which has the possibility to perform the tasks described previously and a lot more. &nbsp;As I mentioned earlier, Windows PowerShell has full support for executables, so another approach for performing a network scan would be to invoke nmap.exe and parse the XML output into a Windows PowerShell custom object to utilize the benefits of Windows PowerShell when working with the ouput. The following example demonstrates how to run nmap.exe and output the results to an XML document.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; &amp; &#8216;C:Nmapnmap.exe&#8217; -F 10.0.0.1\/24 -oX C:tempnmap.xml\nNext, we can use <b>Get-Content<\/b> and read the content of the XML document. By adding the <b>[xml]<\/b> data type and placing the cmdlet within parenthesis, the content is read as an XML object.<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $nmap = [xml](Get-Content C:tempnmap.xml)<\/p>\n<p style=\"padding-left: 30px\">PS &gt; $nmap.nmaprun.host<\/p>\n<p style=\"padding-left: 30px\">&nbsp;<\/p>\n<p style=\"padding-left: 30px\">starttime : 1340110002<\/p>\n<p style=\"padding-left: 30px\">endtime &nbsp;: 1340110018<\/p>\n<p style=\"padding-left: 30px\">status&nbsp; : status<\/p>\n<p style=\"padding-left: 30px\">address &nbsp;: {address, address}<\/p>\n<p style=\"padding-left: 30px\">hostnames :<\/p>\n<p style=\"padding-left: 30px\">ports&nbsp; &nbsp;: ports<\/p>\n<p style=\"padding-left: 30px\">times&nbsp; &nbsp;: times<\/p>\n<h3>Downloads<\/h3>\n<ul>\n<li>To download this entire code sample, see <a href=\"http:\/\/gallery.technet.microsoft.com\/scriptcenter\/Invoke-TSPingSweep-b71f1b9b\" target=\"_blank\">Invoke-TSPingSweep<\/a> in the Script Center Repository.<\/li>\n<li>Additional functions and code related to security are available on the <a href=\"http:\/\/www.truesec.com\/security\/tools\" target=\"_blank\">TruSec<\/a> website.<\/li>\n<li>For more information about Nmap, see the <a href=\"http:\/\/nmap.org\/\" target=\"_blank\">NMAP.ORG<\/a> site.<\/li>\n<\/ul>\n<p>~Niklas\nI want to thank Niklas for an interesting and informative blog. Security Week will continue tomorrow with Part 2 of Niklas&rsquo;s security series.\nI invite you to follow me on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send email to me at <a href=\"http:\/\/blogs.technet.commailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a>, or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then, peace.<\/p>\n<p><b>Ed Wilson, Microsoft Scripting Guy<\/b>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Guest blogger, Niklas Goude, discusses using Windows PowerShell to perform ping sweeps and port scans on a connected network. Microsoft Scripting Guy, Ed Wilson, is here. This week we have guest blogger Niklas Goude. Before we get to Niklas, I want to mention that you should mark your calendars for September 15, 2012 because [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[161,56,183,3,63,45],"class_list":["post-8841","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-firewall","tag-guest-blogger","tag-niklas-goude","tag-scripting-guy","tag-security","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Guest blogger, Niklas Goude, discusses using Windows PowerShell to perform ping sweeps and port scans on a connected network. Microsoft Scripting Guy, Ed Wilson, is here. This week we have guest blogger Niklas Goude. Before we get to Niklas, I want to mention that you should mark your calendars for September 15, 2012 because [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/8841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=8841"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/8841\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=8841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=8841"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=8841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}