Leia e siga Usando propriedades calculadas e Trabalhando com tabelas Hash .
Usando o % co_de do Outlook Enumeração% e Enumeração OlAccountType , as seguintes snippet de código deve fazer o trabalho:
$AccntTypes = @{ '0' = 'Exchange';
'1' = 'IMAP';
'2' = 'POP3';
'3' = 'HTTP';
'4' = 'EAS';
'5' = 'unknown'}
$ExchConnModes = @{'0' = 'Exchange';
'800' = 'Online';
'700' = 'CachedConnectedFull';
'600' = 'CachedConnectedDrizzle';
# (incomplete; please update from 'OlExchangeConnectionMode' Enumeration)
}
Add-Type -assembly "Microsoft.Office.Interop.Outlook"
$Outlook = New-Object -comobject Outlook.Application
$namespace = $Outlook.GetNameSpace("MAPI")
$namespace.Accounts |
Select-Object DisplayName, SmtpAddress, UserName,
@{Name="AccountType";
Expression={$AccntTypes[[string]$_.AccountType]}} ,
@{Name="ExchangeConnectionMode";
Expression={$ExchConnModes[[string]$_.ExchangeConnectionMode]}} |
Sort-Object -Property SmtpAddress | Format-Table