Thursday, July 31, 2014

Activesync Device Report Exchange 2010

To get a list of activesync devices for all mailboxes in organisation can be achieved using the scripts found on Brian Desmond's blog, here:
http://briandesmond.com/blog/how-to-create-an-activesync-device-report/


You can use a single line to get the details of a specific user:
Get-Mailbox -Identity %USER% | ForEach-Object {Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity}


EG:  Get the ActiveSync Statistics for user anonit:
Get-Mailbox -Identity anonit | ForEach-Object {Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity}


If users have multiple devices, it may be best to use the EXPORT-CSV cmdlet.  EG:
Get-Mailbox -Identity anonit | ForEach-Object {Get-ActiveSyncDeviceStatistics -Mailbox $_.Identity} | Export-CSV ActiveSyncReport-anonit.csv



Thursday, July 24, 2014

Exchange 2010 Tracking logs and Powershell



When using the EMC to search tracking logs, you cannot search with wildcards.  You can use the Exchange Shell to do this.


Get-MessageTrackingLog returns an object with the following properties and methods:
 


Name
MemberType
 Definition
----
----------
 ----------
Equals
Method
 bool Equals(System.Object obj)
GetHashCode
Method
 int GetHashCode()
GetType
Method
 type GetType()
ToString
Method
 string ToString()
ClientHostname
Property
 System.String ClientHostname {get;}
ClientIp
Property
 System.String ClientIp {get;}
ConnectorId
Property
 System.String ConnectorId {get;}
EventData
Property
 System.Collections.Generic.KeyValuePair`2[[System.String, mscorlib, Version=2.0...
EventId
Property
 System.String EventId {get;}
InternalMessageId
Property
 System.String InternalMessageId {get;}
MessageId
Property
 System.String MessageId {get;}
MessageInfo
Property
 System.String MessageInfo {get;}
MessageLatency
Property
 System.Nullable`1[[Microsoft.Exchange.Data.EnhancedTimeSpan, Microsoft.Exchange...
MessageLatencyType
Property
 Microsoft.Exchange.Management.TransportLogSearchTasks.MessageLatencyType Messag...
MessageSubject
Property
 System.String MessageSubject {get;}
RecipientCount
Property
 System.Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, Pu...
Recipients
Property
 System.String[] Recipients {get;}
RecipientStatus
Property
 System.String[] RecipientStatus {get;}
Reference
Property
 System.String[] Reference {get;}
ReturnPath
Property
 System.String ReturnPath {get;}
Sender
Property
 System.String Sender {get;}
ServerHostname
Property
 System.String ServerHostname {get;}
ServerIp
Property
 System.String ServerIp {get;}
Source
Property
 System.String Source {get;}
SourceContext
Property
 System.String SourceContext {get;}
Timestamp
Property
 System.DateTime Timestamp {get;}
TotalBytes
Property
 System.Nullable`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, Pu...


 


Given this information, we can use these properties to search tracking logs for required details.  EG:


To get a list of all emails from any address @gmail.com between the dates 10-07-14 and 15-07-14, use the following command (must use MM/DD/YYYY date format, even though regional settings are for Australia!) (one line):


Get-MessageTrackingLog –ResultSize Unlimited –Start “07-10-2014” –End “07-15-2014” | where {$_.sender –like “*@gmail.com”}


Combining this with a select-object we can get specific details about the object returned.  To show the TimeStamp, Source, Event ID, Sender, Recipients, Message Subject and Size, use the following (one line):


Get-MessageTrackingLog –ResultSize Unlimited –Start “07-10-2014” –End “07-15-2014” | where {$_.sender –like “*@gmail.com”} | Select-Object Timestamp, Source, EventID,Sender, {$_.Recipients}, MessageSubject,TotalBytes


You can also use Export-CSV to get the data into a CSV (one line):


Get-MessageTrackingLog –ResultSize Unlimited –Start “07-10-2014” –End “07-15-2014” | where {$_.sender –like “*@gmail.com”} | Select-Object Timestamp, Source, EventID,Sender, {$_.Recipients}, MessageSubject,TotalBytes | –Export-CSV –path export.csv


Search with a wildcard subject (not case sensitive) (one line):


Get-MessageTrackingLog –ResultSize Unlimited | where {$_.MessageSubject –like “*Dell*”} | Select-Object Timestamp, Source, EventID,Sender, {$_.Recipients}, MessageSubject,TotalBytes

Thursday, July 17, 2014

Forward Emails in Exchange 2010

Open the Exchange Management Console

 

Expand Microsoft Exchange On-Premise and Recipient Configuration.  Select Mailbox

Right click on the mailbox you wish to forward and click Properties

Select the Mail Flow Settings tab.  Select Delivery Options and click Properties…

Select Forward To: and click Browse

Select the user you wish to forward emails to, and click OK

If you wish to send the email to the original mailbox and forward it, select Deliver message to both forwarding address and mailbox.

Click OK.

Click OK on the users Mailbox Properties

Close the Exchange Management Console

 

To do this in Powershell, Open the Exchange Management Shell and use the following commands:

Set-Mailbox –Identity “%IDENTITY%” –ForwardingAddress %ADDRESS%

eg:

Set-Mailbox –Identity “ANONIT” –FowardingAddress anonit@example.com

 

To deliver both to the mailbox and the forward address, use the –DeliverToMailboxAndForward $TRUE

eg: to deliver to ANONIT and anonit@example.com

Set-Mailbox –Identity “ANONIT” –FowardingAddress anonit@example.com –DeliverToMailboxAndForward $TRUE

Thursday, July 10, 2014

Changing Exchange 2010 mailbox permissions using Powershell

I needed to give a user full control over every users mailbox in an Exchange 2010 environment.  After getting the required permissions and authority, I used the following powershell command:

get-mailbox | add-mailboxpermission -user '%ALIAS%' - Accessrights 'FullAccess'

where %ALIAS% is the alias of the user who will be given permissions to the mailbox.

EG: Bob needs access to every mailbox:

get-mailbox | add-mailboxpermission -user 'BOB' - Accessrights 'FullAccess'

Thursday, July 3, 2014

Blackberry link fails to install: Error 1920 Rim Tunnel Service

When trying to install or upgrade the Blackberry Link software on Server 2008 R2, it may fail with:

Blackberry Link Installer Information

Error 1920.Service Blackberry Link Communication manager (Rim Tunnel Service) failed to start.  Verify that you have sufficient privileges to start system services.

Starting the service manually logs the following errors:

A timeout was reached (nnnnn milliseconds) while waiting for the Blackberry Link

communication Manager service to connect

and

The Blackberry Link Communication Manager service failed to start due to the following error: The service did not respond to the start or control request in a timely fashion.

Rebooting, run as admin, uninstall the old version, removing files, and old registry keys fail to resolve.

Checking the service, we can see that it executes “%PROGRAMFILESX86%\Research in Motion\Tunnel Manager\tunmgr.exe” with a switch of service

Attempting to execute this program interactively provides the following error:

tunmgr.exe – System Error

The program can’t start because Wlanapi.dll is missing from your computer.  Try reinstalling the program to fix this problem

To resolve this, install the Wireless Lan Service Feature in Service Manager

Alternatively you can install this using Powershell using the following commands:

Import-Module ServerManager

Add-WindowsFeature Wireless-Networking

The Blackberry Link should now install.