Saturday, June 1, 2019

Repair connection (WinRM not available using kerberos authentication into the /Powershell SCP

The problem

"The following error occured while attempting to connect to the specific exchange server . The attempt to connect to http /powershell using kerberos authentication failed: connecting to remote server failed with the following message: The WInRM client sent a request to an http server and got a response saying the requested http url was not availabe. This is usually returned by the http server that does not support the WS-Management protocol."

 

 

The Solution

1. Run a PowerShell script to check All Service Connection Point (SCP) entries

a. Open a Powershell for exchange or simple powershell with administrative privilegies (using Run as Administrator):

 

b. Check that all the URLs are fine withmy script on technet with the option: "-Get"

The correct way to run the script will be as follows
#Change Executionpolicy (just in case you haven't done this already),
Set-ExecutionPolicy unrestricted
#Accept the warning (by pressing Y or A then press enter)

#Run the script (move to the folder where the script is downloaded) 
cd "C:\Users\joseo\Downloads"
.\setAllv2.ps1 -Get
You will get something like this:

Optional (for setting up internal and externals URL, all at once on a single server): In case you want to set all the internals and externals URL with my script you can do so by running it with the option -Set -urlpath "https://mail.yourdomain.com"

You would get something similar to this pic:

if this doesn't fix the issue go to step 2 (don't close your powershell console we will still need it).

 

2. Remove and Enable the HTTP on the winRM

Just run:
$IPAddress= (Get-NetIPAddress | ?{ $_.AddressFamily -eq "IPv4"  -and !($_.IPAddress -match "169") -and !($_.IPaddress -match "127") }).IPAddress
winrm delete winrm/config/Listener?Address=*+Transport=HTTP
winrm create winrm/config/Listener?Address="IP:$IPAddress+Transport=HTTP"
Check if it's working.

3. Follow the instructions:

  1. Open IIS Manager, and then navigate to Default Web Site.
  2. Right-click Default Web Site, and then click Edit Bindings. If a binding exists for HTTP, clear the hostname value. If no binding exists for HTTP, create a new binding that has no host name and a value of All Unassigned for the IP address.
  3. Restart IIS.
#when you got the results just return the executionpolicy 
#(when you finished working with powershell scripts, as a good practice )
Set-ExecutionPolicy remotesigned
Answer's Source: TechNet And that's it! thank you for reading

Please consider to donate and thank you very much for reading this.

RPC Folder missing in IIS (Exchange server 2010/2013/2016)

The problem

Exchange server doesn't have the A client has this issue recently on Exchange server 2013 SP1 (works for all versions of exchange server from 2007 to 2016 (2010,2013). This happens because of the lack of free space in the transport server (2010) or mailbox server role 2013/2016. The specific error was: "Resource Monitoring and 452 4.3.1 Insufficient system resources."

The Solution

1. Check the Local space for the logs and for the edb (files on the exchange server)

a. Open a Powershell for exchange or simple powershell with administrative privilegies (using Run as Administrator):

 

b. Run my script from technet at https://gallery.technet.microsoft.com/office/What-is-the-size-of-my-0e1993a7 to check Database (.EDB file) and and Logs size in the server

The correct way to run the script will be as follows

#Change Executionpolicy,
Set-ExecutionPolicy unrestricted
#Run the script (move to the folder where the script is downloaded) 
#Ex: in the downloads of the user 'joseo'
cd "C:\Users\joseo\Downloads"
.\ExchangeDBnLogsize.ps1

You will get something like this:

Note: Please Do not modify the edgetransport.exe.config file, it's a bad practice, and it's just a workaround NOT a solution

 

2. Enable circular logs on the Exchange Server databases

The Easiest way to check if your server has enabled or not this feature, open an exchange powershell console and run:

#Checking CircularLogging exchange 2010/2013/2016
#You will get the True/false result and the name of the database.
get-MailboxDatabase | select Name,CircularLoggingEnabled

#To Enable it
Get-MailboxDatabase| Set-MailboxDatabase -CircularloggingEnabled:$true
On exchange server 2007 will be like this: https://technet.microsoft.com/en-us/library/bb331968%28v=exchg.80%29.aspx?f=255&MSPPError=-2147217396
And you can also do it graphically by doing the following this steps: http://geekswithblogs.net/marcde/archive/2013/08/09/enabling-circular-logging-in-exchange-2013.aspx
After that it will be necessary to unmount and mount again all the databases.

 

3. Create a Windows Backup with 'VSS Full Backup'

Here's the technet article to do this: https://technet.microsoft.com/en-us/library/dd876854(v=exchg.160).aspx
http://www.techrepublic.com/blog/tr-dojo/manage-exchange-log-files-via-windows-server-backup-or-circular-logging/

 

And that's it! thank you for reading

#when you got the results just return the executionpolicy #(when you finished working with powershell scripts, as a good practice ) Set-ExecutionPolicy remotesigned

Please consider to donate and thank you very much for reading this.

Wednesday, May 22, 2019

Emails going into Draft in a On-premises environment

The problem

You are using OWA or outlook to send your emails (your mail server is an on-premises Exchange server) and all the emails are going into the Draft folder of the user.

The Solution

1. Check the Local services using the Services.msc or services console to make sure that all the exchange servers are set to automatic and are running.

https://msexperttalk.com/exchange-2013-email-stuck-in-draft/ https://www.exchangeitpro.com/2016/06/13/exchange-server-2013-components-in-an-inactive-state/ https://gallery.technet.microsoft.com/exchange/SetExchangeComponentToActiv-874bcd4b

a. Open a Powershell for exchange or simple powershell with administrative privilegies (using Run as Administrator):

 

b. Run my script from technet at https://gallery.technet.microsoft.com/office/What-is-the-size-of-my-0e1993a7 to check Database (.EDB file) and and Logs size in the server

The correct way to run the script will be as follows

#Change Executionpolicy,
Set-ExecutionPolicy unrestricted
#Run the script (move to the folder where the script is downloaded) 
#Ex: in the downloads of the user 'joseo'
cd "C:\Users\joseo\Downloads"
.\ExchangeDBnLogsize.ps1

You will get something like this:

Note: Please Do not modify the edgetransport.exe.config file, it's a bad practice, and it's just a workaround NOT a solution

 

2. Enable circular logs on the Exchange Server databases

The Easiest way to check if your server has enabled or not this feature, open an exchange PowerShell console and run:

#mail server name (On-premises exchange)
$smtpServer= "mail"
#email from can exists or not onprem
$from = "abc@xyz.com"
#to email (must exists, so you can receive the email)
$to = "jose@domain.com"
$event =Get-EventLog -Log "MSExchange Management" | Where{$_.Message -Like "*Enable-Mailbox*"} | select -first 1 

if($event){
    $MailBodyString= $event | ConvertTo-Html 
    #WE CAN'T ATTACH THE FULL THML INTO THE FILE DIRECTLY SO WE NEED TO USE THE TEXT IN THE MIDDLE OF THE  AND 
TAGS WHICH IS DONE USING REGEX #all the results are dump into a table tags so we extract those. $regex = new-object regex('(?s)(< table>(.*)<\</table>)', ([System.Text.RegularExpressions.RegexOptions]::Compiled -bor [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)) $MailBodyAsHtml = $Regex.Match($MailBodyString).VALUE Send-MailMessage -From $from -To $to -Subject "New Account created" -Body $MailBodyAsHtml -SmtpServer $smtpServer -BodyAsHtml }

 

And that's it!, thank you for reading

#when you got the results just return the executionpolicy #(when you finished working with powershell scripts, as a good practice ) Set-ExecutionPolicy remotesigned

Please consider to donate and thank you very much for reading this.

Send an email on HTML format with the information of the latest New Mailbox created on your exchange server

The problem

Send an email with the latest mailbox created in your exchange server and email it to sombody

 

 

The Solution

Over a PowerShell script to

a. Open a Powershell for exchange or simple powershell with administrative privilegies (using Run as Administrator):

&nbsp

It can be done using this following commands

The correct way to run the script will be as follows
#name of the server (exchange server on-premises)
$smtpServer= "mail" 
#from address where you want to receive the email, can exist or not
$from = "abc@xyz.com"
#your email address (must exists, so you can actually receive the email
$to = "jose@domain.com"
$event =Get-EventLog -Log "MSExchange Management" | Where{$_.Message -Like "*Enable-Mailbox*"} | select -first 1 

if($event){
    $MailBodyString= $event | ConvertTo-Html 
    #WE CAN'T ATTACH THE FULL THML INTO THE FILE DIRECTLY SO WE NEED TO USE THE TEXT IN THE MIDDLE OF THE tables tags 
TAGS WHICH IS DONE USING REGEX
    $regex = new-object regex('(?s)(<table>(.*)<\/table>)', ([System.Text.RegularExpressions.RegexOptions]::Compiled -bor [System.Text.RegularExpressions.RegexOptions]::IgnoreCase))
    $MailBodyAsHtml = $Regex.Match($MailBodyString).VALUE
    Send-MailMessage -From $from -To $to -Subject "New Account created" -Body $MailBodyAsHtml -SmtpServer $smtpServer -BodyAsHtml
}
You will get an email in HTML format with the last event information And that's it! thank you for reading
Please consider to donate and thank you very much for reading this.

Tuesday, May 21, 2019

Get a list of all domains where you have received emails on the last 60 days

The problem

How can I get a list of all domains that I've received email from in the last 2 months

 

 

The Solution

Over a PowerShell script to

a. Open a Powershell for exchange or simple powershell with administrative privilegies (using Run as Administrator):

 

It can be done using this following commands

The correct way to run the script will be as follows
#Change Executionpolicy (just in case you haven't done this already),
Set-ExecutionPolicy unrestricted
#Accept the warning (by pressing Y or A then press enter)

#Run the script (move to the folder where the script is downloaded) 
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;
$localdomain= "mydomain.com" # local domain public to be excluded on the search
Get-MessageTrackingLog -Server Mail -Start $( (Get-Date).ADddays(-60) ) -End $( Get-Date) -ResultSize Unlimited | select Recipients,EventId | where { ($_.EventId -eq "RECEIVE") -and $_.Recipients -notmatch "HealthMailbox*"}  | select -ExpandProperty Recipients | where{ $_ -notmatch $localdomain} | %{ $_.Split('@')[1]} | select -Unique
You will get the list of all unique domains list on the screen, if you want to have them in another format you can pipe
#Run the script (move to the folder where the script is downloaded) 
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;
$localdomain= "mydomain.com" # local domain public to be excluded on the search
Get-MessageTrackingLog -Server Mail -Start $( (Get-Date).ADddays(-60) ) -End $( Get-Date) -ResultSize Unlimited | select Recipients,EventId | where { ($_.EventId -eq "RECEIVE") -and $_.Recipients -notmatch "HealthMailbox*"}  | select -ExpandProperty Recipients | where{ $_ -notmatch $localdomain} | %{ $_.Split('@')[1]} | select -Unique | Out-File domains.txt
And that's it! thank you for reading

Please consider to donate and thank you very much for reading this.

Monday, August 14, 2017

Can't connect to your Exchange Server Console? Ex2010/13/16

The problem

"The following error occured while attempting to connect to the specific exchange server . The attempt to connect to http /powershell using kerberos authentication failed: connecting to remote server failed with the following message: The WInRM client sent a request to an http server and got a response saying the requested http url was not availabe. This is usually returned by the http server that does not support the WS-Management protocol."

 

 

The Solution

1. Run a PowerShell script to check All Service Connection Point (SCP) entries

a. Open a Powershell for exchange or simple powershell with administrative privilegies (using Run as Administrator):

 

b. Check that all the URLs are fine withmy script on technet with the option: "-Get"

The correct way to run the script will be as follows
#Change Executionpolicy (just in case you haven't done this already),
Set-ExecutionPolicy unrestricted
#Accept the warning (by pressing Y or A then press enter)

#Run the script (move to the folder where the script is downloaded) 
cd "C:\Users\joseo\Downloads"
.\setAllv2.ps1 -Get
You will get something like this:

Optional (for setting up internal and externals URL, all at once on a single server): In case you want to set all the internals and externals URL with my script you can do so by running it with the option -Set -urlpath "https://mail.yourdomain.com"

You would get something similar to this pic:

if this doesn't fix the issue go to step 2 (don't close your powershell console we will still need it).

 

2. Remove and Enable the HTTP on the winRM

Just run:
$IPAddress= (Get-NetIPAddress | ?{ $_.AddressFamily -eq "IPv4"  -and !($_.IPAddress -match "169") -and !($_.IPaddress -match "127") }).IPAddress
winrm delete winrm/config/Listener?Address=*+Transport=HTTP
winrm create winrm/config/Listener?Address="IP:$IPAddress+Transport=HTTP"
Check if it's working.

3. Follow the instructions:

  1. Open IIS Manager, and then navigate to Default Web Site.
  2. Right-click Default Web Site, and then click Edit Bindings. If a binding exists for HTTP, clear the host name value. If no binding exists for HTTP, create a new binding that has no host name and a value of All Unassigned for the IP address.
  3. Restart IIS.
#when you got the results just return the executionpolicy 
#(when you finished working with powershell scripts, as a good practice )
Set-ExecutionPolicy remotesigned
Answer's Source: TechNet And that's it! thank you for reading

Please consider to donate and thank you very much for reading this.

Friday, February 10, 2017

Resource Monitoring and 452 4.3.1 Insufficient system resources in Exchange

The problem

A client has this issue recently on Exchange server 2013 SP1 (works for all versions of exchange server from 2007 to 2016 (2010,2013). This happens because of the lack of free space in the transport server (2010) or mailbox server role 2013/2016. The specific error was: "Resource Monitoring and 452 4.3.1 Insufficient system resources."

The Solution

1. Check the Local space for the logs and for the edb (files on the exchange server)

a. Open a Powershell for exchange or simple powershell with administrative privilegies (using Run as Administrator):

 

b. Run my script from technet at https://gallery.technet.microsoft.com/office/What-is-the-size-of-my-0e1993a7 to check Database (.EDB file) and and Logs size in the server

The correct way to run the script will be as follows

#Change Executionpolicy,
Set-ExecutionPolicy unrestricted
#Run the script (move to the folder where the script is downloaded) 
#Ex: in the downloads of the user 'joseo'
cd "C:\Users\joseo\Downloads"
.\ExchangeDBnLogsize.ps1

You will get something like this:

Note: Please Do not modify the edgetransport.exe.config file, it's a bad practice, and it's just a workaround NOT a solution

 

2. Enable circular logs on the Exchange Server databases

The Easiest way to check if your server has enabled or not this feature, open an exchange PowerShell console and run:

#Checking CircularLogging exchange 2010/2013/2016
#You will get the True/false result and the name of the database.
get-MailboxDatabase | select Name,CircularLoggingEnabled

#To Enable it
Get-MailboxDatabase| Set-MailboxDatabase -CircularloggingEnabled:$true
On exchange server 2007 will be like this: https://technet.microsoft.com/en-us/library/bb331968%28v=exchg.80%29.aspx?f=255&MSPPError=-2147217396
And you can also do it graphically by doing the following this steps: http://geekswithblogs.net/marcde/archive/2013/08/09/enabling-circular-logging-in-exchange-2013.aspx
After that it will be necessary to unmount and mount again all the databases.

 

3. Create a Windows Backup with 'VSS Full Backup'

Here's the technet article to do this: https://technet.microsoft.com/en-us/library/dd876854(v=exchg.160).aspx
http://www.techrepublic.com/blog/tr-dojo/manage-exchange-log-files-via-windows-server-backup-or-circular-logging/

 

And that's it! thank you for reading

#when you got the results just return the execution policy #(when you finished working with PowerShell scripts, as a good practice ) Set-ExecutionPolicy remotesigned

Please consider to donate and thank you very much for reading this.