function Get-CurrentDomainName { <# .SYNOPSIS Get the current domain name of the machine #> [CmdletBinding()] param ( ) if (Test-IsWindowsPlatform) { return (Get-CimInstance Win32_ComputerSystem -Property Domain).Domain } return $null }