Something I need to keep for usage in the future:

$hostname=hostname
If (get-exchangeserver $hostname | where {$_.isClientAccessServer -eq $true})
    {
    } else {
    }
   
If (get-exchangeserver $hostname | where {$_.isHubTransportServer -eq $true})
    {
    } else {
    }

If (get-exchangeserver $hostname | where {$_.isMailboxServer -eq $true})
    {
    } else {
    }

If (get-exchangeserver $hostname | where {$_.isUnifiedMessagingServer -eq $true})
    {
    } else {
    }

If (get-exchangeserver $hostname | where {$_.isEdgeServer -eq $true})
    {
    } else {
    }