In this article, we'll go over a script I wrote to help you check VPN connectivity between connected sites.
The script will read the IP addresses for the different branch offices’ gateway from a .txt file and then check for connectivity by running a Ping function.
The script consists of two functions. The first one is the Ping function shown below:
In this function, we are calling the"Win32_PingStatus" WMI class and outputting the IP address followed by the response time, the inconsistent reply data, and finally the ping status code (success or failure).
For a complete list of properties, you can check Win32_PingStatus Class on MSDN.
The second function is SendMail, which will actually send a log file as an attachment.
The function is shown below:
The above function will send an E-mail while attaching the file “logs.txt.”
Now that we have both functions ready, let's use some WindowsPowerShell cmdlet to call both functions:
To keep track of history logs, we're adding the date and time each time the script will run.
Once these are all set, you can save the script to a .ps1 extension file and schedule it to run at a specific custom time.
The output will look like the below figure:
In this scenario, we already have in place two Exchange Mailbox servers: Exchange and Exchange1 and we already have created MailboxDatabase ElieB01 on Exchange and ElieB02 on Exchange2.
This guide will help go over the required steps which willallows you to create DAG for your organization
Step 1:
Go to ExchangeServer àGo to Exchange Management Shell à type the below
New-DatabaseAvailabilityGroup-Name DAG01 -WitnessServer DC -DatabaseAvailabilityGroupIPAddresses192.168.2.15
Read the warning message. In a production environment,it is recommended to use an available server that is a member of the ExchangeServers Group. For the purpose of this lab, it is acceptable to use DC.
Tip: In order to fix the error,put the computer (DC) in the Exchange Trusted Subsystem security group and put that group in the local administrators group account
Step 2:
Now that you’ve created the DAG, you can add servers to it by typing:
Add-DatabaseAvailabilityGroupServer-Identity DAG01 -MailboxServer Exchange
Note: FailoverClustering will be installed automatically on the server when it is added tothe DAG. After the command completes successfully, verify that the ClusterService has started by using the Services management console.
Step 3:
You have the option to add Exchange1 through GUI.
A- Open the ExchangeManagement Console à Database Availability Group à DAG01
B- Click on ManageDatabase Availability Group Membership and click to add Exchange 1
C- Click OK and than Next to add the DAG
Step 4:
After adding both servers, you can check the status of the DAG.
Go back to Exchange à Exchange Management Shell and type the cmdlet:
Get-DatabaseAvailabilityGroup–Identity DAG01 –Status
Step 5:
Now, you are ready to start distributing mailboxes between both Mailbox Databases
To do so using PowerShell:
A- Go to Exchange Management Shell and type the below:
“elie@dc1.elie.org”,“lea@dc1.elieb.org”| New-MoveRequest -TargetDatabase ElieB01
B- To check the status of the move, type Get-MoveRequest
Step 6:
To distribute mailboxes using the GUI interface:
A- Go to Exchange Management Console
B- In the Navigation pane, expand MicrosoftExchange On-Premises >Recipient Configuration >Mailbox
C- Select the mailboxes you want to move and click on New Local Move Request
D- Click on Browse to choose the target mailbox database
E- Click Next to start the process and wait for the process completion