Check Azure VPN connection health

Hi Scripters! Today I want to show you how to check Azure VPN connection health using PowerShell. In my last post I showed you how to Setup Azure VPN. We will continue last topic about VPN but from monitoring perspective. It’s important to monitor Azure resources, specially if we connect Azure with On-premise environemnt. By default there is not standard monitoring solution which can help us to diagnose connectivty issue. …

Log lines

Extract IP address from log lines using PowerShell

Recently I had to extract IP Addresses from log file and check their hostnames. The easiest way to get this was using regex pattern in Select-String command. Extract IP Address Lets says that we have a log file which contains lines like: AUDIT “2018-06-19 00:14:16.481 GMT+0200” 10.13.11.7 Server01:1812 0 0 “text=Access GRANTED cloudId=pawel.janowicz To extract IP Address from it we can use Select-String command with the following regex pattern “\d{1,3}(\.\d{1,3}){3}”>: …

Setup Azure VPN using PowerShell

Hey Scripters! Today I want to share with you my script for setup Azure VPN using PowerShell. In few words, script is using basic Azure module command. At the begginig you should have your VPN device already configured and once it is done, you can start configuration from Azure site. To configure VPN device you should already have public IP created in Azure. All variables depends on your on premise …

Create Azure VNET peering using PowerShell

Today I want to show you how in easy way create Azure VNET peering using PowerShell. What is VNET peering? VNET peering allows to connect virtual networks to each other. When virtual networks are peered, all resourcses inside those networks are able to communicate the same way and with the same bandwidth if the resources will be created in the same virtual network. Script: Example of usage: I hope it …

Get Azure VNET private IPs which are in use

In my previous article I showed you how to set IP restirctions on WebApp. Today I want to show you how to get Azure VNET private IPs which are in use. Recently I was looking for PowerShell script which will help me to find VNET IPs which are already in use. The only command which I found was Test-AzureRmPrivateIPAddressAvailability. Unfortunately command can only check if specific IP address is available …

PowerShell Tip of the Week: Check connectivity to multiple servers

You can find multiple articles on our blog about checking connectivity. This time I want to show you how to check it for bunch of servers on specific port. Check connectivity Script will use Test-NetConnection command where you can specify port number. For single machine you can use the following one-liner script: On the beginning you have to provide servers and destination servers againts which you want to check connection: …

PowerShell Tip of the Week: File browser

Today’s tip will be about file browser in PowerShell. Its a nice feature where you can just select the server list instead of writing path inside the code. File browser To select the file we’re gonna use System.Windows.Forms. The System.Windows.Forms namespace contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system. For more information please visit technet …

PowerShell Tip of the Week: Get FQDN

Today I want to show you how to use .Net class to get FQDN (Fully Qualified Domain Name). A fully qualified domain name is the complete domain name for a specific computer. The FQDN consists of two parts: the hostname and the domain name like for example: DC01.powershellbros.com Get FQDN In this article we will focus on DNS class which is a static class that retrieves information about a specific …

PowerShell Tip of the Week: Get IP address

There are multiple ways to get IP address information. Most common are ipconfig or Get-NetIPAddress command. Today I want to show you how to check this quickly using ping class. Get IP address To check IP configuration we can use one of the following one-liner commands Our script is based on .NET Framework System.Net.NetworkInformation ping class: Output: Results will be displayed in console and at the end saved into CSV …

Use PowerShell to format port query (PortQry) output

Recently I had to check connectivity to several servers on some specific ports using PortQry. As some of you already know this command will return some kind of the connectivity test report. I wanted to convert this into nice formatted table. Port Query Port Query – Display the status of TCP and UDP ports, troubleshoot TCP/IP connectivity and security, return LDAP base query info, SMTP, POP3, IMAP4 status, enumerate SQL …