Check if the machine is domain-joined:

(Get-CimInstance -ClassName Win32_ComputerSystem).Domain

Get detailed domain and role info:

Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object Domain, DomainRole, PartOfDomain

Get the domain controller being used:

(Get-ADDomainController -Discover).Name

Using systeminfo to check domain:

systeminfo | Select-String "Domain"