Private/Helper/Test-IsAADJoined.ps1
<#
Copyright © 2024 Integris. For internal company use only. All rights reserved. #> FUNCTION Test-IsAADJoined { <# .SYNOPSIS Determines if the system is joined to Azure Active Directory. .DESCRIPTION This function checks the domain services registration status to determine if the system is joined to Azure Active Directory. .PARAMETER None .EXAMPLE Test-IsAADJoined .NOTES The function uses the dsregcmd command to check the Azure AD joined status. #> $DomainServicesRegistration = dsregcmd /status IF ($DomainServicesRegistration -like "*DomainJoined : YES*") { RETURN $False } ELSEIF ($DomainServicesRegistration -like "*AzureAdJoined : YES*" -and $DomainServicesRegistration -like "*DomainJoined : NO*") { RETURN $True } ELSEIF ($DomainServicesRegistration -like "*AzureAdJoined : NO*" -and $DomainServicesRegistration -like "*DomainJoined : NO*") { RETURN $False } ELSE { RETURN $False } } |