The first flushes the DNS cache, the second updates the DNS registration, and the third performs an NSLookup on the server. I print out a message that lets me know a problem occurs with reaching the computer. If(!(Test-Connection -Cn $s -BufferSize 16 -Count 1 -ea 0 -quiet))īecause I am hiding errors that are returned from the Test-Connection cmdlet, I decided to display my own status information. This portion of the script is shown here. I therefore state that if the command does not return a True value, I want to perform additional actions. Note For more information about using the Test-Connection, cmdlet refer to Query AD for Computers and Use Ping to Determine Status.īecause the cmdlet returns a Boolean value, I am able to simplify the code a bit. The value of 0 tells the cmdlet to not display error information (an error displays when a ping is unsuccessful). I specify the ea parameter ( ea is an alias for the ErrorAction parameter) value of 0. In the definition of the Test-Connection command, I determine the buffer size, the number of pings to submit, and whether it returns detailed ping status information or a simple Boolean value. To ping the computers, I use the Test-Connection cmdlet. The $s variable represents the actual computer name inside the loop. To walk through the array of servers, I used the ForEach statement. I manually created an array of computer names that I stored in a variable called $servers. I wanted to ensure that DNS resolution worked, so I did the ping by name instead of by IP address. When I ran into problems, I decided to write a really quick script to ping the most critical servers on my network to ensure connectivity. Writing a quick script to ensure connectivity The router they showed up with at the house-part of the free installation-would not accept a static IP address on the Ethernet side of the equation that was compatible with my current network configuration-and I have a relatively complex configuration that involves multiple subnets. Now for the bad news part of the equation… Talk about not just good news, but GREAT NEWS. After months of trying to obtain faster Internet connectivity at the house, I finally found a source that doubled the upload and download speeds for the Scripting Wife and I, at literally half the price we had been paying. It seems that there are always good news/bad news types of scenarios. Microsoft Scripting Guy, Ed Wilson, is here. Summary: Microsoft Scripting Guy talks about using Windows PowerShell to test connectivity after a network configuration change.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |