Powershell 删除终止用户发出的会议请求

Powershell 删除终止用户发出的会议请求,powershell,exchange-server,exchange-server-2010,Powershell,Exchange Server,Exchange Server 2010,需要一次从所有会议室删除多个终止用户的终止用户发出的会议请求 下面是我构建的脚本,用于删除所有会议室中两个终止用户的会议请求。如果我想删除两个终止用户的会议(种类:calendar from:sasi或Kalai),我使用了或操作符。如何一次添加两个以上的终止用户?我有500多个终止用户可以从所有会议室删除他们的会议请求 Write-Progress -Activity "Preparing" -Status "Retrieving mailbox list" -PercentComplete

需要一次从所有会议室删除多个终止用户的终止用户发出的会议请求

下面是我构建的脚本,用于删除所有会议室中两个终止用户的会议请求。如果我想删除两个终止用户的会议(种类:calendar from:sasi或Kalai),我使用了
操作符。如何一次添加两个以上的终止用户?我有500多个终止用户可以从所有会议室删除他们的会议请求

Write-Progress -Activity "Preparing" -Status "Retrieving mailbox list" -PercentComplete 0
$rooms=get-mailbox -recipienttypedetails roommailbox -resultsize unlimited -warningaction:silentlycontinue| where {$_.name -notlike "*test*"}

$count=$rooms.count

foreach($room in $rooms)

{


    $i=$i+1
    $percentage=$i/$count*100


    Write-Progress -Activity "Collecting mailbox details" -Status "Processing mailbox $i of $Count - $room" -PercentComplete $percentage

$room | search-mailbox -searchquery "kind:calendar from:sasi OR Kalai" -targetmailbox sankar_munirathinam@domain.com -targetfolder "Deleting Meeting" -deletecontent -force

}

我想我可以帮你回答这个问题!我在stack上的第一个答案(我记得):)

您应该将终止用户的用户名(或其他标识符)放入文本文件中,然后在行下方插入新行

$count=$rooms.count

就是

$TerminatedUsers=获取内容。\TerminatedUsersList.txt

然后添加另一行,即

foreach($TerminatedUsers中的用户){

然后在脚本的末尾添加最后一个右大括号
}

最后,将
从:sasi或Kalai更改为
从:$($User)

这将通过每个终止的用户进行循环,对于每个用户,它将搜索所有房间邮箱以查找他们的会议


我希望这对您有意义。

因此,如果我正确理解上述内容,您会做以下操作吗?如果这仅仅是调查性的,你可以采取“删除内容-强制”措施

Write-Progress -Activity "Preparing" -Status "Retrieving mailbox list" -PercentComplete 0
$rooms=get-mailbox -recipienttypedetails roommailbox -resultsize unlimited -    
warningaction:silentlycontinue| where {$_.name -notlike "*test*"}

$count=$rooms.count
$TerminatedUsers = Get-Content .\TerminatedUsersList.txt
foreach ($User in $TerminatedUsers) {
foreach($room in $rooms)

{


$i=$i+1
$percentage=$i/$count*100


Write-Progress -Activity "Collecting mailbox details" -Status "Processing mailbox $i of $Count -
$room" -PercentComplete $percentage

$room | search-mailbox -searchquery "kind:calendar from:$($user)" -targetmailbox    
administrator@domain.com -targetfolder "Deleting Meeting" -deletecontent -force

}
}