エイリアス コマンドを実行して、結果を .csv に出力しようとしています。実行するコマンドはありますが、エクスポート コマンドを追加する構文がわかりません。誰か助けてくれませんか?
私が使用しているコマンドは次のとおりです:
get-mailbox | foreach{
$host.UI.Write("Blue", $host.UI.RawUI.BackGroundColor, "`nUser Name: " + $_.DisplayName+"`n")
for ($i=0;$i -lt $_.EmailAddresses.Count; $i++)
{
$address = $_.EmailAddresses[$i]
$host.UI.Write("Blue", $host.UI.RawUI.BackGroundColor, $address.AddressString.ToString()+"`t")
if ($address.IsPrimaryAddress)
{
$host.UI.Write("Green", $host.UI.RawUI.BackGroundColor, "Primary Email Address`n")
}
else
{
$host.UI.Write("Green", $host.UI.RawUI.BackGroundColor, "Alias`n")
}
}
}