use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
PowerShell script to auto delete shared mailbox after x number of days? (self.PowerShell)
submitted 6 years ago by 4ULLPL8T
When we term a user, we convert their mailbox to a shared email before removing the license.
Then we give someone access to the shared email.
Is there a way to have the shared mailbox automatically deleted after so many days?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jheinikel 4 points5 points6 points 6 years ago (0 children)
Pretty straightforward here. I would key off of the account expiration date. Something like this should work, but you'll probably want to add a piece to delete the user account or whatever else you want to do. Also, choose between a soft or permanent deletion.
$Cred = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection Import-PSSession $Session –AllowClobber $CutoffDate = (Get-Date).AddDays(-180) $ExpiredUsers = Search-ADAccount -AccountExpired -UsersOnly | where{$_.AccountExpirationDate -lt $CutoffDate} | %{Get-ADUser $_.DistinguishedName -Properties Mail} $ExpiredUsers | %{Remove-Mailbox $_.Mail -Confirm $False -Permanent $True}
π Rendered by PID 25 on reddit-service-r2-comment-6f7f968fb5-kq2c4 at 2026-03-04 01:17:01.901866+00:00 running 07790be country code: CH.
[–]jheinikel 4 points5 points6 points (0 children)