Nous avons une boite aux lettres pour les scripts.
Et du jour au lendemain, celle-ci ne fonctionnait plus … elle Ă©tait pleine đ
Vous pouvez la vider manuellement, et ensuite mettre des rĂšgles de filtrage. Mais c’est bien plus fun de la vider en Powershell !
Pour afficher la taille de la boite (une fois connecter sur Exchange)
1 |
Get-MailboxFolderStatistics "script@mondomain.tld" | select -f 1 FolderAndSubfolderSize |
Pour supprimer la totalité de la boite :
1 |
Search-Mailbox -Identity "script@mondomain.tld" -DeleteContent -force |
Pour automatiser ça (Pour généré son mot de passe voir ici)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
$Key = [byte]44,13,57,35,92,10,33,28,12,43,77,21,17,20,86,52 $login = "exemple@mondomain.tld" $password=Convertto-SecureString -key $key -string "76492d1116743f0423413b16050a5345MgB8AHUASAA1AEEAbQBCAHEAUQBkADYAcABXAGkAOQBjAHAAMgA2AFAAMwBCAHcAPQA9AHwAOQA1AGIANQBmAGUANABkAGQAZgAzADQAMwAwADkAZ AAyADEANwA2AGYANQA3ADMAZgBiADIAYQA1ADUAOAAzADkANAA1AGUAMQBlAGUAYQBiAGIAMQBiAGYAZQAwAGQAMgAwADcAZQBjAGQAZgA2ADIAZgA3ADMAYwA2ADcAZgA1ADgAOQAwAGEANA BkAGMAOQA2ADcAOABjADgAYQBmAGEAZQBlADcAOAAyADEANQAxADUAYQBjADkAMQBkADIAMABjAGYANwBjADMANQBjADgAYwA1ADUAMwA4AGYAYwBjADMAYQA0ADkAMAA2ADcAYgBiADQAYwB lADUANQA3AA==" $credentials = New-Object System.Management.Automation.Pscredential -Argumentlist $login,$password $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Credentials -Authentication Basic -AllowRedirection Import-PSSession $Session Connect-MsolService -Credential $credentials #LE DEBUT EST FIORITURE, CONNEXION A LA BOITE Get-MailboxFolderStatistics "script@mondomain.tld" | select -f 1 FolderAndSubfolderSize #AFFICHE LA TAILLE DE LA BOITE Search-Mailbox -Identity "script@mondomain.tld" -DeleteContent -force #SUPPRIME LA TOTALITE DE LA BOITE |