private/Test-O365DirSync.ps1

<#
.Synopsis
This powershell cmdlet tests whether or not you are on your local server running Azure Directy Sync.
  
.Description
Tests if you are on your 'DirSync' server.
  
.Example
Test-O365DirSync
#>

Function Test-O365DirSync{
     $dirsync = Get-Service AzureADConnectHealthSyncMonitor -ErrorAction SilentlyContinue
            if ($dirsync -eq $null) {
                Write-Host "Attempting to run a Directory Sync on a system not provisioned with Azure Active Directory Connect - ABORTING OPERATION!" -ForegroundColor Red
                break
                }
                }