【问题标题】:Pipe to Get-Mailbox in Echange Online管道到 Exchange Online 中的 Get-Mailbox
【发布时间】:2021-03-28 03:58:41
【问题描述】:

在这种情况下是强制使用ForEach-Object 还是我可以将变量直接通过管道传递给Get-Mailbox

$importuser = Import-Csv -Path C:\mymailbox.csv -OutVariable string
$importuser | ForEach-Object {
  get-mailbox -identity $_.Name|Select-Object primarysmtpaddress,whenMailboxCreated
} | ConvertTo-Csv -NoTypeInformation | Set-Content -Path "exportwhithedate"

【问题讨论】:

  • 我不明白你的意思。 [blush] 你能试着重述你的问题吗? ///// 同样,Import-Csv cmdlet 没有任何输出......这意味着-OutVariable 参数不会做任何事情。 ///// 同样,你永远不要尝试使用-OutVariable 结果。

标签: powershell office365 exchange-server


【解决方案1】:

由于-Identity 接受管道输入(根据the docs 和我的测试),您可以通过管道输入:

$importUser.name | Get-Mailbox # And so on

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-06-13
    • 1970-01-01
    • 2016-06-17
    • 2014-10-07
    • 2022-09-29
    • 2016-05-15
    • 2015-03-26
    • 2018-10-22
    相关资源
    最近更新 更多