Automatically Delete Old Log Files with a Powershell Script

I use a scheduled task to run a script very similar to this one every midnight to clean up log files on one of my servers. It deletes any files in c:\logs that are more than 30 days old and any files in c:\special\logs that are more than 7 days old. Just change the paths and retention times to suite your requirements. # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # […]

Read Me Leave comment

Running Exchange 2010 PowerShell Scripts Using Task Scheduler

I have a number of complex PowerShell scripts for performing employee onboarding/offboarding, mailbox export request cleanup, and other tasks. Scripts that use the standard cmdlet set, the Active Directory module, or Quest Activeroles AD Management snapin worked fine, but Exchange 2010 and Lync 2010 cmdlets didn’t despite loading the Exchange Management and Lync snapins. Those cmdlets didn’t seem to do anything at all and the […]

Read Me Leave comment

Use PowerShell to manage FullAccess permissions on mailboxes

Every now and then you’ll have a user who has FullAccess to umpteen mailboxes for whatever reason. Cross-forest mailbox migrations, for example. Over time you might lose track of what mailboxes they have access to or why and Outlook starts misbehaving. Shared mailboxes no longer automap in Outlook or they don’t update properly, etc. When you use PowerShell to add FullAccess to another mailbox, you […]

Read Me Leave comment

Clean out old mailbox export requests

Since Exchange 2010 doesn’t automatically remove old mailbox export requests, periodically you need to clear them out manually. This short little script cleans out all mailbox export requests that were completed more than 7 days ago. I run it about once per week. You could also schedule it if you want. $CompletedRequests = Get-MailboxExportRequest -Status Completed $EndDate = (Get-Date).AddDays(-7) $CompletedRequests | ForEach { if ((Get-MailboxExportRequestStatistics […]

Read Me 2 Comments

Two Ways to Add Multiple Users or Contacts to a Distribution Group

Say you just created a large number of new Mail Contacts or you just created a new Distribution Group and you need to add the new contacts or a large number of users to the new group. There are multiple ways to do this. I’ll show you two of them that are useful in two different scenarios. Method One: If all of the objects are […]

Read Me Leave comment

New-MailboxExportRequest: Couldn’t Connect to the Source Mailbox

When you run this cmdlet: New-MailboxExportRequest <username> -FilePath \\servername\sharename\username.pst …and you get this error message: Couldn’t connect to the source mailbox. + CategoryInfo          : NotSpecified: (0:Int32) [New-MailboxExportRequest], RemotePermanentException + FullyQualifiedErrorId : B1C4188,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest …the most common problem is that the source mailbox has been hidden from the GAL. Oddly, it doesn’t happen with every mailbox that is hidden. It is probably a combination of factors, such […]

Read Me Leave comment

Find All Room Mailboxes on Which a User Is a Delegate

If you manage Exchange for a large organization, you probably dread personnel changes in the central offices. Executives and their assistants are connected to so many projects and resources, it can be very difficult to keep track of them, let alone transfer ownership or access to their successors. Unfortunately, Exchange doesn’t provide any simple, built in way of tracking and managing resource mailbox delegation. If […]

Read Me Leave comment