Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Подключаем модуль
- Import-Module ExchangeOnlineManagement
- $UserPrincipalName = Read-Host "Please put your UserPrincipalName"
- # Подключаемся к Excange
- Connect-IPPSSession -UserPrincipalName $UserPrincipalName
- # Запрашиваем адрес
- $mail_address = Read-Host "Please put the Mail address"
- # Получаем MessageID и пишем в файл
- Get-QuarantineMessage -SenderAddress "$mail_address"| Format-Table Identity -HideTableHeaders | Out-File "C:\quarantined.txt"
- # Чистим файл от пустых линий
- Get-Content "C:\quarantined.txt" | where {$_ -ne ""} | Out-File "C:\quarantined1.txt"
- $mail_id = Get-Content "C:\quarantined1.txt"
- # Восстанавливаем каждое сообщение
- Foreach ($line in $mail_id )
- {
- Release-QuarantineMessage -Identity $line -ReleaseToAll
- }
- # Удаляем файлики
- Remove-Item "C:\quarantined.txt"
- Remove-Item "C:\quarantined1.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement