Author: Steve Man
Giving Reviewer Rights to a calendar of a bunch of Exchange Mailboxes
Add a Calendar Meeting in Outlook through Powershell
The link at the bottom of this blog contains a good script that will allow you to create calendar meetings in Outlook through PowerShell. This was helpful when I had to buildup a calendar in size to simulate another users exchange calendar for testing. Below are the changes I made to the script so I could add attachments into newly created calendar appointments. I know-I know, we shouldn’t be adding attachments into the appointment directly, hence the reason for the simulation of the problems the user is experiencing that needs to be proven.
I added this parameter/variable in the list of parameters:
# Attachment Location, to hold value similart to: C:folderattachment.jpg
[string] $file
Boom. Now I can run the following command to create an appointment and add an attachment to build up the size of the calendar:
Add-CalendarMeeting -Subject “test recurring219” -Location “Steves Cube” -Body “Test” -MeetingStart “5/14/2014 18:00” -MeetingDuration 30 -file “C:UsersusernameDesktopfileabstract.jpg”
Link to the Original Script for download.
Removing Duplicate Contact Items in a Exchange Mailbox
Scenario: You have a mailbox that has hundreds of copies of their contacts in their mailbox. For example, a user originally had 2500 contacts and now has 800,000 contacts because of the multiple copies. Here are the steps I followed to resolve this issue.
1. Export their contacts in the users Outlook to a CSV. In my scenario, the outlook session was locking up so I exported the PST out via Exchange Shell and then re-exported to a CSV out of Outlook. (New-MailboxExportRequest mailbox -IncludeFolders “#Contacts#” -ExcludeDumpster -FilePath servershare$contacts.pst -name mailbox -acceptlargedataloss -baditemlimit 999)
Outlook 2013: File–>Open&Export–>Import/Export–>Export to a File–>Comma Separated Values–>Select Contacts Folder–>Save Exported File to location –> Click Finish.
2. Open Powershell, and Import the CSV created in step 1 into a Variable.
$File = Import-CSV “C:usersusernamedesktopuserscontacts.csv”
3. Select the unique values for the $File, compares all columns.
$uniq = $File | Select * -unique
4. Export the unique values to a .csv file
$uniq | Export-csv “C:usersusernamedesktopuserscontacts_unique.csv”
5. Delete the existing contacts in the users mailbox via Exchange Shell. The Search-Mailbox has a 10,000 item limit. I put the command in a loop so it continues to remove all contacts at 10,000 per loop cycle.
do {
Write-Host $i
Search-Mailbox mailbox -SearchQuery kind:contacts -DeleteContent -Force
$i++
}
while ($i -le 81)
6. Opened Outlook 2013 and followed similar steps as step 1, except I performed the import on the unique CSV. Note, I did have to clean up the CSV by removing the very first line as the very first line was not the column names. In order for the CSV import to work, the first line needs to be the column names and NOT the other junk that export may have carried over.
Now the unique contacts are restored.
Find a Message in the message tracking log against every transport server in your Exchange Org
The Powershell one liner below will search the Message Tracking Log against every transport server in your Exchange Organization. Note that you may want to change the Select statement to include/remove which values you want to pull back into view (you can replace with the entire Select statement with FL to see every value available).
Get-TransportServer | Get-MessageTrackingLog -Sender:user@domain.com -Recipients user@domain.com -MessageSubject “another test” -Start 5/8/2014 | Sort Timestamp | Select TimeStamp, EventID, Source, MessageSubject, ClientIP, ClientHostname, ServerIP, ServerHostname
Restart a Service Remotely through PowerShell
The PowerShell command below will restart a service remotely on another computerserver.
Restart-Service -InputObject $(Get-service -ComputerName ExMbx1 -name msexchangetransport)
How to install the latest applicable updates for Microsoft Outlook
The article in the link below describes how to check to see if your Outlook is up to date and provides useful information about how to find your Outlook version and other important update information.
Re-Enabling PST functionality in your Outlook session.
Scenario: You cannot open or create a PST within your Outlook. The options are missing OR it does not allow to complete a PST operation. If you try to Integrate SharePoint with your Outlook, you may receive the following error:
Outlook cannot add the folder because creating a new Outlook data file (.pst) file isn’t allowed on this computer.
Solution: The registry has a DisablePST value that is set to not allow PST functionality. The data for this key is:
0 = Enables PST functionality
1 = Disable PST Functionality Completely
2 = Disables creating PST’s, but allows to open PST’s.
1. Open up the registry (regedit).
2. Click on Edit-Find and type in DisablePST. Perform a find. Keep hitting F3 to perform a ‘find next’ if this doesn’t take you directly to the key.
3. Delete the Key or Set it to the corresponding value. Deleting the key or giving it a 0 are one in the same.
Searching it take you to a location similar to: HKEY_LOCAL_MACHINESOFTWAREMicrosoftOffice<version>Outlook. This location may be different if using a 64 bit version of Outlook.
Exchange PowerShell script that will perform a mailbox count on each database and email the results.
Below is a Exchange PowerShell script that will perform a mailbox count on each database and email the results. The script is performed with the get-mailboxstatistics for each mailbox on that database as the results are much faster than the get-mailbox command.
# Create an empty HashTable to store database name and count.
$MailboxCount = @{}
# Collect Databases
$databases = Get-mailboxDatabase | Where Name -like “2013DB*” | Sort name
#Loop through each
ForEach ($database in $databases){
$MBs = Get-mailboxstatistics -database $database
$MailboxCount.Add($Database,$MBs.count)
}
#Format the Results
$MailboxCountOrdered = $MailboxCount.GetEnumerator() | Sort-Object Name | Out-String
$orderedMailboxCount = $MailboxCount.GetEnumerator() | Sort-object Value | Out-String
#Send an email:
$SmtpClient = new-object system.net.mail.smtpClient
$MailMessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = “mail.server.com”
$mailmessage.from = (“MailboxCount@domain.com”)
$mailmessage.To.add(“email.address”)
$mailmessage.Subject = “Mailbox Count”
$mailmessage.Body = “Mailbox Count
The following list shows the Mailbox Count for the Databases in Ex2013. The 2 lists below are the same; one is in order of database name and the other is in order of mailbox count.
Database Order:
$MailboxCountOrdered
Count Order:
$OrderedMailboxCount
“
$smtpclient.Send($mailmessage)
Process Meeting Requests Automatically from a Exchange user Mailbox
Scenario: If you have a normal Exchange user mailbox that is not a resource, you can configure Outlook to process the meeting request automatically. To do so, perform the following within Outlook:
Click on File–>Options
1. Navigate to Mail–>Tracking. Make sure there is a check mark in Automatically process meeting requests and responses to meeting requests and polls.
2. Navigate to Calendar–>Automatic accept or decline. From here you can select from the menu how you wish to automatically process meeting requests:
- Automatically accept meeting requests and remove canceled meetings
- Automatically decline meeting requests that conflict with an existing appointment or meeting
- Automatically decline recurring meeting requests