Use PowerShell function to check if servers are accessible

Recently I had to check quickly if all of managed servers are accessible. As SCOM monitoring wasn’t set yet in my environment I had to create simple script to do that. One of the easiest method to check if server is up is to test availability of network share. Test-Path There are many ways to check if server is accessible like for example using ping, checking some specific service but …

PowerShell one-liner: Test connectivity

In this one-liner series I would like to show you several ways to test connectivity. There are lots of methods and basic commands to check network connection like ping, telnet, tracert etc. However it this post you will find out how to combine other PowerShell commands into one-liner script. Most common PowerShell command is Test-Connection which returns basically the same output as Ping. To use it for a bunch of …

Test LDAP Connection with PowerShell

In this article you will find out how to test LDAP Connection to your domain controllers. It is very similar to previous post about Test-PortConnection function. In this example we will focus on making an LDAP connection using ADSI. On the beginning of function we need to check if DC name provided as a parameter is valid: Usage: Final script:

Test connection to servers on several ports

Below you can find simple function to test connection on several ports. Sometimes you had to check connectivity in your environment to all servers. This script will make it easy for you. Script use Test-NetConnection command which allows to specify port number for checking: For more information about this command please refer to technet site. Usage: Output: Final script:

Pester framework for Powershell testing – part 1

Today let’s talk a little bit about framework for Powershel script testing called Pester. Pester is quite fresh framework which is user friendly and very easy in implementation. I want to share with you basic example of using Pester commandlets. Let’s focus on three basic commands Describe – define name of the test group under which Context and It blocks exists. Context – define grouping of It blocks. Usually used …