Showing posts with label Exchange Management Powershell Command. Show all posts
Showing posts with label Exchange Management Powershell Command. Show all posts

Friday, April 11, 2014

Send-MailMessage : Mailbox unavailable. The server response was: 5.7.1 Unable to relay

You may receive the below error message when you try to execute PowerShell script to trigger email

  Send-MailMessage

 Send-MailMessage : Mailbox unavailable. The server response was: 5.7.1 Unable to relay
At C:\Temp\Get-ExchangeEnvironmentReport.ps1:1096 char:2
+     Send-MailMessage -Attachments $HTMLReport -To $MailTo -From $MailFrom -Subject ..

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   + CategoryInfo         : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpFailed   RecipientException
   + FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage

To fix it out follow the below solution

Right click on McAfee icon

VirusScan Console 1

Click on Virus Scan Console

VirusScan Console

Double click on Access Protection on VirusScan Console - On Access Protection tab

Access Protection

Go to Anti-Virus Standard Protection - On right hand side, double click on Prevent mass mailing
worms from sending mail

Anti-Virus Access Protection

On process to exclude tab, add PowerShell.exe at the end

Exception Powershell

Click ok

Thursday, March 27, 2014

Exchange Server 2013 - Full Access Mailbox Permission Vs Send AS Permissions



Exchange Server 2013 - Full Access Mailbox Permission Vs Send AS Permissions
When USERA who want to have full access permission of another user mailbox USERB (i.e will allow only to open the other user mailbox and view the folders and emails) which can be achieved using the Exchange 2013 PowerShell cmdlet Add-MailboxPermission. 

Although USERA have full acccess permission on USERB mailbox, USERA will not able to send email as USERB. In order to achieve it we need to user Add-ADPermission with Send-As Permission.

Earlier when user have full access they can able to send email as another user.This change was brought in place after the Exchange 2003 SP2 hotfix release. 

To provide Send on Behalf of permission use Set-Mailbox cmdlet

E.g Adding: Set-Mailbox -Identity Raji -GrantSendOnBehalfto Mark

      Removing: Set-Mailbox -Identity Raji -GrantSendOnBehalfto @{Remove="mark@mail.com"}
Note:

  • Send As Permission                        ------------ Add-Adpermission,
  • Full Access Mailbox Permission  ------------  Add-MailboxPermission. 
  • SendOnBehalf                                   ------------ Set-Mailbox


Ø  Outlook uses the external namespace to connect to alternate mailboxes, even though Outlook is located on the internal network in Exchange Server 2013”. Reference: http://support.microsoft.com/kb/2839517

Adding Mailbox Permission with AutoMapping

Add-MailboxPermission -Identity Mark -User 'Raji' -AccessRights FullAccess -InheritanceType All -AutoMapping $True


 Verifying Mailbox Permission

Get-MailboxPermission -Identity Mark | Format-List


To find specific user access of Mailbox Permission

Get-MailboxPermission -Identity Mark  -User "Rajis" | Format-List

To find owner of the mailbox

Get-MailboxPermission -Identity Mark –Owner


To remove Mailbox Permission

Remove-MailboxPermission -Identity Mark -User Rajis -AccessRights FullAccess -InheritanceType All
To provide Send-As Permission

Add-ADPermission -Identity "Mark" -User RajiS  -AccessRights ExtendedRight -ExtendedRights "Send As"
To check extended permission 

Get-ADPermission Mark -User Rajis | ft identity, user, extendedrights, accessrights

To remove AD Permission

Remove-ADPermission -Identity Mark  -User RajiS  -ExtendedRights "Send As"

Wednesday, January 8, 2014

Combining Muliple DAG and MAPI networks - Exchange 2010 DAG Network

Combining Muliple DAG and MAPI networks - Exchange 2010 DAG Network

When you have Primary Site and secondary site hosting Exchange 2010 Mailbox server and configuring DAG network. You can able to view four network under DAG network

 2 MAPI network one in Primary Site (170.0.0,x/16) and one in secondary site (170.1.0,x/16).
 2 Replication network one in Primary Site (30.0.1.0/24) and one in secondary site (30.0.2.0/24).

This can be collasped easily using the following Exchange Powershell Command

Set-DatabaseAvailabilityGroupNetwork DAG1DAGNetwork01 -Subnets 170.0.0,0/16,170.1.0,0/16

Set-DatabaseAvailabilityGroupNetwork DAG1DAGNetwork02 -Subnets 30.0.1.0/24,30.0.2.0/24

Still the network holds the default name inorder to have proper nomenclature run the following command

Set-DatabaseAvailabilityGroupNetwork DAG1DAGNetwork01 -Name MAPI_Network

Set-DatabaseAvailabilityGroupNetwork DAG1DAGNetwork02 -Name Replication_Networ

The following command will disable replication traffic through the MAPI network.

Set-DatabaseAvailabilityGroupNetwork MAPI_Network –ReplicationEnabled $false

In Exchange Server 2013 we don't need to perform the collapsing of DAG Network since it does automatically Ref: http://technet.microsoft.com/en-us/library/dd297927%28v=exchg.150%29.aspx

Saturday, January 4, 2014

Exchange management Powershell Error Message: The WSMan client cannot process the request. Proxy is not supported under HTTP transport.

Exchange management Powershell Error Message:

New-PSSession : Connecting to remote server failed with the following error message : The WSMan client cannot process the request. Proxy is not supported under HTTP transport. Change the transport to HTTPS and specify valid proxy information and try again. For more information, see the
about_Remote_Troubleshooting Help topic.
+                 & $script:NewPSSession `
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin
   gTransportException
    + FullyQualifiedErrorId : AccessDenied,PSSessionOpenFailed
Exception calling "GetSteppablePipeline" with "1" argument(s): "No session has been associated with this implicit
remoting module"
+             $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.C ...
+     + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : RuntimeException

 Solution:

  • Verify the session state using the powershell command  - Get-Pssession | fl The value are  All, Opened, Disconnected, Closed, and Broken.
  • Remove the broken powershell session using the command - remove-pssession -id 1
  • Check the internet proxy setting - Go to internet Explorer - Tools - Internet Options - Connections - Lan Settings
  • Verify the netsh winhttp show proxy
  • Export the registry and then delete the WinHttpSettings key from the registry location HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\WinHttpSettings

Ref: http://blogs.technet.com/b/exchange/archive/2010/02/04/3409289.aspx
        http://exchangeserverpro.com/exchange-2010-certificate-revocation-checks-and-proxy-settings/







Friday, January 3, 2014

Exchange Powershell command error message Microsoft.PowerShell.Commands.Internal.Format.AutosizeInfo Microsoft.PowerShell.Commands.Internal.Format.TableHeaderInfo

Exchange Powershell command error message
 Microsoft.PowerShell.Commands.Internal.Format.AutosizeInfo Microsoft.PowerShell.Commands.Internal.Format.TableHeaderInfo
On executing the below powershell on exporting to html file it will result error message in the html file
Get-MailboxDatabase -Status | Sort-Object DatabaseSize -Descending | ft Name, DatabaseSize -Autosize | ConvertTo-HTML -head $a | Out-File C:\Temp\DBFileSize.htm
Solution:
On removing the format-table and -autosize from the powershell command the error message disappered. Finally the command changed as follows,
Get-MailboxDatabase -Status | Sort-Object DatabaseSize -Descending | Select-Object Name, DatabaseSize, AvailableNewMailboxSpace | ConvertTo-HTML | Out-File C:\Temp\DBFileSize.htm

The blog is written to the share the knowledge mainly on Microsoft Exchange Server and other Microsoft product that experienced on day-to-day life.