Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Book Image

Microsoft Exchange 2010 PowerShell Cookbook

Overview of this book

Table of Contents (22 chapters)
Microsoft Exchange 2010 PowerShell Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Verifying server connectivity


When writing your own monitoring and troubleshooting scripts, you need a way to verify that remote systems are online and responding. This can be useful when building a script that needs to poll servers on a regular basis, or to do a routine check within a script to verify that a server is online before invoking one or more commands. In this recipe, we'll take a look at how you can use the shell to verify connectivity of remote servers.

How to do it...

  1. To verify that a remote system is available, use the Test-Connection cmdlet:

    Test-Connection -ComputerName mbx1
  2. The -ComputerName parameter accepts an array of arguments, so you can test multiple systems at once by specifying multiple server names separated by a comma:

    Test-Connection -ComputerName mbx1,mbx2
  3. Like the ping command, the cmdlet will send four echo requests to the remote host by default. You can override this using the -Count parameter:

    Test-Connection -ComputerName mbx1,mbx2 -Count 1
  4. To verify that all of...