尝试运行脚本时,收到错误消息。
以下是我的脚本:
$saveto = "C:\scripts\Distribution Groups.txt"
filter get_member_recurse {
if($_.RecipientType -eq "MailUniversalDistributionGroup") {
Get-DistributionGroupMember -ResultSize "Unlimited" $_.Name | get_member_recurse
} else {
$output = $_.Name + " (" + $_.PrimarySMTPAddress + ")"
Write-Output $output
}
}
$DistributionGroup = Get-DistributionGroup | Sort-Object Name | ForEach-Object {
"`r`n$($_.DisplayName) ($($_.PrimarySMTPAddress))`r`n=============" | Add-Content $saveto
$distout = Get-DistributionGroupMember -ResultSize "Unlimited" $_.Name | get_member_recurse
Write-Output $distout | Sort-Object | Get-Unique | Add-Content $saveto
}
错误信息:
Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently.
+ CategoryInfo : OperationStopped: (Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [], PSInvalidOperationException
+ FullyQualifiedErrorId : RemotePipelineExecutionFailed
Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently.
+ CategoryInfo : OperationStopped: (Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [], PSInvalidOperationException
+ FullyQualifiedErrorId : RemotePipelineExecutionFailed
Pipeline not executed because a pipeline is already executing. Pipelines cannot be executed concurrently.
+ CategoryInfo : OperationStopped: (Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [], PSInvalidOperationException
+ FullyQualifiedErrorId : RemotePipelineExecutionFailed
3条答案
按热度按时间of1yzvn41#
最近遇到了这个错误,最终发现它来自
FOREACH
(或|%{}
)命令中的一个错误最简单的解决方法是在对象进入foreach之前对其进行 Package
更改此:
对此:
@()
将它们收集到一个数组中1hdlvixo2#
也许这就是你要找的?
p5cysglq3#
这里是同样的事情,但与进度条!!;-)