tacticalrmm/scripts/Win_AzureAD_Check_Connectio...

15 lines
342 B
PowerShell

$ErrorActionPreference = 'silentlycontinue'
$aadchk = dsregcmd /status | Where-Object { $_ -match 'AzureAdJoined : ' } | ForEach-Object { $_.Trim() }
if ($aadchk -Eq 'AzureAdJoined : Yes') {
Write-Output "Machine is Azure Ad Joined"
exit 0
}
else {
Write-Output "Machine is not Azure Ad Joined"
exit 1
}
Exit $LASTEXITCODE