Forum Discussion
Find out a server with Azure AD Connect
Hi, you can launch this by pointing to your servers.
$servers = @("server1", "server2") # Replace with your server names
foreach ($server in $servers) {
Invoke-Command -ComputerName $server -ScriptBlock {
Get-Service -Name ADSync -ErrorAction SilentlyContinue
} | Select-Object PSComputerName, Status
}
If you want you can do this for all the servers in the domain; first install these:
Install-WindowsFeature RSAT-AD-PowerShell
# Import the Active Directory module Import-Module ActiveDirectory # Get all servers in the domain $servers = Get-ADComputer -Filter {OperatingSystem -Like "*Windows Server*"} | Select-Object -ExpandProperty Name # Check each server for the ADSync service foreach ($server in $servers) { try { Invoke-Command -ComputerName $server -ScriptBlock { Get-Service -Name ADSync -ErrorAction SilentlyContinue } | Select-Object PSComputerName, Status } catch { Write-Host "Cannot connect to $server" -ForegroundColor Red } }