I have the below script:
Import-Module UniversalDashboard.Community -Force
$Theme = Get-UDTheme Default
$cred = [System.Net.CredentialCache]::DefaultCredentials
[System.Net.WebRequest]::DefaultWebProxy.Credentials = $cred
$username = “”
$password = Get-Content ‘’ | ConvertTo-SecureString
$Credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password
$Port = 10004
$proxyOptions = New-PSSessionOption -ProxyAccessType IEConfig
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Credentials -Authentication Basic -AllowRedirection -SessionOption $proxyOptions
Import-PSSession $Session -AllowClobber
Dashboard = New-UDPage -Name "Quarantined Emails" -Icon home -Content {
New-UDRow -Columns {
New-UDColumn -Size 12 {
New-UDTable -Title "Quarantined Emails" -Headers @("ReceivedTime", "RecipientAddress","Subject", "Release") -Endpoint {
Get-QuarantineMessage -SenderAddress *Email Address* | Select-Object ReceivedTime,RecipientAddress,Subject,MessageId | ForEach-Object {
[PSCustomObject]@{
ReceivedTime = .ReceivedTime
RecipientAddress = _.RecipientAddress
Subject = .Subject
Release = New-UDButton -Floating -Icon unlock_alt -OnClick {Release-QuarantineMessage -MessageID $_.MessageId; Show-UDToast -Message “Message Released”}
} | Out-UDTableData -Property @(“ReceivedTime”, “RecipientAddress”,“Subject”, “Release”)
}
}
New-UDButton -Text "Release all" -OnClick {
Get-QuarantineMessage -SenderAddress *Email Address* | Release-QuarantineMessage
Show-UDToast -Message "All Quarantined Emails Released"
}
}
}
}
Get-UDDashboard | Stop-UDDashboard
$Dashboard = New-UDDashboard -Title “Quarantined Emails” -Theme $Theme -Pages @($Dashboard)
Start-UDDashboard -Port $Port -Dashboard $Dashboard
I am trying to query O365 Quarantine items for a particular email address and display them with the option of releaseing one or all emails.
Whenever I run this it comes up with an error saying that Get-QuarantineMessage is an unknown command, although I have connected to O365.
Any help would be great
Kind Regards
Sean Buckle