별칭 명령을 실행하고 결과를 .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")
}
}
}