Category Archives: Microsoft

Exchange Tutorials

550 5.7.1 Message rejected as spam by Content Filtering

Content Filtering has been enabled on the recipients’ mail server. This configuration is incompatible with GFI MailEssentials when installed as a relay server, all email filtering should happen on the relay server. For more information on Content Filtering and how to disable it, please see the following:

If the mail server is Microsoft Exchange 2013 and 2016 server:

If the mail server is Microsoft Exchange 2010 server:

If the mail server is Microsoft Exchange 2007 server:

Code Snippets .NET ASP.Net

UnobtrusiveValidationMode requires a ScriptResourceMapping for ‘jquery’ – Asp.NET

erro:

Erro de Servidor no Aplicativo '/'.

WebForms UnobtrusiveValidationMode requer um ScriptResourceMapping para 'jquery'. Adicione um jquery nomeado de ScriptResourceMapping (diferencia maiúsculas de minúsculas).

Descrição: Ocorreu uma exceção sem tratamento durante a execução da atual solicitação da Web. Examine o rastreamento de pilha para obter mais informações sobre o erro e onde foi originado no código. 



Adicionar no web.config

 <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
  </appSettings><span style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" data-mce-type="bookmark" class="mce_SELRES_start"></span>
Exchange Microsoft PowerShell

Enable antispam functionality on Mailbox servers

Applies to: Exchange Server 2016

Topic Last Modified: 2016-03-28

Use the Install-AntispamAgents.ps1 PowerShell script to install and enable the built-in Exchange antispam agents on a Mailbox server.

The following antispam agents are available in the Transport service on Exchange 2016 Mailbox servers, but they aren’t installed by default:

  • Content Filter agent
  • Sender Filter agent
  • Sender ID agent
  • Protocol Analysis agent for sender reputation

You can install these antispam agents on a Mailbox server by using an Exchange Management Shell script, which is important if these agents are your only defense to help prevent spam. Typically, you don’t need to install the antispam agents on a Mailbox server when your organization uses other types of antispam filtering on incoming mail.

noteNote:
Although the Recipient Filter agent is available on Mailbox servers, you shouldn’t configure it. When recipient filtering on a Mailbox server detects one invalid or blocked recipient in a message that contains other valid recipients, the message is rejected. The Recipient Filter agent is enabled when you install the antispam agents on a Mailbox server, but it isn’t configured to block any recipients. For more information, see Recipient filtering procedures on Edge Transport servers.
  • Estimated time to complete this task: 15 minutes
  • You can only use PowerShell to perform this procedure. To learn how to open the Exchange Management Shell in your on-premises Exchange organization, see Open the Exchange Management Shell.
  • The Connection Filtering agent and the Attachment Filtering agent aren’t available on Mailbox servers. They’re only available on Edge Transport servers, and they’re installed and enabled there by default. However, the Malware agent is installed and enabled by default on Mailbox servers. For more information, see Anti-malware protection.
  • If you have other Exchange antispam agents operating on the messages before they reach the Mailbox server (for example, an Edge Transport server in the perimeter network), the antispam agents on the Mailbox server recognize the antispam X-header values that already exist in messages, and those messages pass through without being scanned again.
  • You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the “Transport configuration” entry in the Mail flow permissions topic.
  • For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard shortcuts in the Exchange admin center.

 

tipTip:
Having problems? Ask for help in the Exchange forums. Visit the forums at: Exchange Server, Exchange Online, or Exchange Online Protection.

read more »

Code Snippets Active Directory PowerShell

PowerShell: Get-ADUser to retrieve password last set and expiry information

Get-ADUser -identity username -properties *
 get-aduser -filter * -properties passwordlastset, passwordneverexpires |ft Name, passwordlastset, Passwordneverexpires
get-aduser -filter * -properties passwordlastset, passwordneverexpires | sort name | ft Name, passwordlastset, Passwordneverexpires

Export the list to CSV so we can work on it in Excel. In this example we substitute, format table (ft) for select-object.

Type:

Get-ADUser -filter * -properties passwordlastset, passwordneverexpires | sort-object name | select-object Name, passwordlastset, passwordneverexpires | Export-csv -path c:\temp\user-password-info-20131119.csv

PowerShell: Get-ADUser to retrieve password last set and expiry information


read more »

Code Snippets Exchange PowerShell

Turn Exchange Anonymous Relay On or Off or View Connector Status

This EMS script for Exchange 2007-2016 allows Exchange Administrators to toggle anonymous external relay permissions on front-end Receive Connectors. Connectors listed in Yellow allow anonymous SMTP emails to any internal or external recipients. Connectors listed in White only

Toggle-ExternalRelayReceiveConnectors


C:\_tmp>.\Toggle-ExternalRelayReceiveConnectors.ps1

Toggle External Relay

1 - SRV-EXCH2\Client Frontend EXSERVER1
2 - SRV-EXCH2\Default Frontend EXSERVER1
3 - SRV-EXCH2\Outbound Proxy Frontend EXSERVER1
X - Exit

Which Receive Connector to toggle:

This EMS script for Exchange 2007-2016 allows Exchange Administrators to toggle anonymous external relay permissions on front-end Receive Connectors. Connectors listed in Yellow allow anonymous SMTP emails to any internal or external recipients. Connectors listed in White only allow SMTP emails to internal recipients. Run this script from the Exchange Management Shell.

See my blog for more information: http://www.expta.com/2016/01/turn-exchange-anonymous-relay-on-or-off.html

read more »

Code Snippets Office365 PowerShell

Office 365 : Password Sync doesn’t synchronize with Azure AD Connect

Verified password sync is disabled via using PowerShell

Following cmdlets have been used to verify above and I noticed password sync was in fact disabled although I checked the option in Azure AD connect setup.

Import-Module ADSync
Get-ADSyncAADPasswordSyncConfiguration -SourceConnector <‘LOCAL DOMAIN NAME>

Enabled password sync via PowerShell

Set-ADSyncAADPasswordSyncConfiguration -SourceConnector <‘LOCAL DOMAIN NAME> -TargetConnector <‘xxxxxxx.onmicrosoft.com – AAD’> -Enable $true

 

thanks to: http://www.tekronin.net/2015/10/09/office-365-woes-password-sync-doesnt-synchronize-with-azure-ad-connect/

Office 365 woes | Password Sync doesn’t synchronize with Azure AD Connect

Code Snippets .NET VB

Dynamically Generate and Display Barcode Image in ASP.Net

n this article I will explain how to dynamically generate and display barcode image using ASP.Net in C# and VB.Net languages.
 
Barcode Font
First you will need to download the Free Barcode Font from the following URL
Once downloaded follow the following steps.
1. Extract the ZIP file.
2. Click and Execute INSTALL.exe file.
3. After installation is completed restart your machine.



 

<form id="form1" runat="server">
<asp:TextBox ID="txtCode" runat="server"></asp:TextBox>
<asp:Button ID="btnGenerate" runat="server" Text="Generate" onclick="btnGenerate_Click" />

<hr />

<asp:PlaceHolder ID="plBarCode" runat="server" />
</form>




 


 
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.IO

 

 


Protected Sub btnGenerate_Click(sender As Object, e As EventArgs)
    Dim barCode As String = txtCode.Text
    Dim imgBarCode As New System.Web.UI.WebControls.Image()
    Using bitMap As New Bitmap(barCode.Length * 40, 80)
        Using graphics__1 As Graphics = Graphics.FromImage(bitMap)
            Dim oFont As New Font("IDAutomationHC39M", 16)
            Dim point As New PointF(2.0F, 2.0F)
            Dim blackBrush As New SolidBrush(Color.Black)
            Dim whiteBrush As New SolidBrush(Color.White)
            graphics__1.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height)
            graphics__1.DrawString("*" & barCode & "*", oFont, blackBrush, point)
        End Using
        Using ms As New MemoryStream()
            bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png)
            Dim byteImage As Byte() = ms.ToArray()
 
            Convert.ToBase64String(byteImage)
            imgBarCode.ImageUrl = "data:image/png;base64," & Convert.ToBase64String(byteImage)
        End Using
        plBarCode.Controls.Add(imgBarCode)
    End Using
End Sub

 

 

 

 

https://www.aspsnippets.com/Articles/Dynamically-Generate-and-Display-Barcode-Image-in-ASPNet.aspx

.NET ASP.Net 2.0 IIS

The page was not displayed because the request entity is too large. iis7

“The page was not displayed because the request entity is too large.”

 

I think this will fix the issue IF you have SSL enabled:

Setting uploadReadAheadSize in applicationHost.config file on IIS7.5 would resolve your issue in both cases. You can modify this value directly in applicationhost.config.

1) Select the site under Default Web Site

2) Select Configuration Editor

3) Within Section Dropdown, select “system.webServer/serverRuntime”

4) Enter a higher value for “uploadReadAheadSize” such as 1048576 bytes. Default is 49152 bytes.

During client renegotiation process, the request entity body must be preloaded using SSL preload. SSL preload will use the value of the UploadReadAheadSize metabase property, which is used for ISAPI extensions

Reference: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/7e0d74d3-ca01-4d36-8ac7-6b2ca03fd383.mspx?mfr=true

 

Code Snippets SQL Server Transact-SQL

DBCC SHRINKFILE (Transact-SQL)

A. Shrinking a data file to a specified target size

The following example shrinks the size of a data file named DataFile1 in the UserDB user database to 7 MB.


USE UserDB;
GO
DBCC SHRINKFILE (DataFile1, 7);
GO

B. Shrinking a log file to a specified target size

The following example shrinks the log file in the AdventureWorks database to 1 MB. To allow the DBCC SHRINKFILE command to shrink the file, the file is first truncated by setting the database recovery model to SIMPLE.


USE AdventureWorks2012;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE AdventureWorks2012
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (AdventureWorks2012_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE AdventureWorks2012
SET RECOVERY FULL;
GO

C. Truncating a data file

The following example truncates the primary data file in the AdventureWorks database. The sys.database_files catalog view is queried to obtain the file_id of the data file.


&nbsp;

USE AdventureWorks2012;
GO
SELECT file_id, name
FROM sys.database_files;
GO
DBCC SHRINKFILE (1, TRUNCATEONLY);

D. Emptying a file

The following example demonstrates the procedure for emptying a file so that it can be removed from the database. For the purposes of this example, a data file is first created and it is assumed that the file contains data.


USE AdventureWorks2012;
GO
-- Create a data file and assume it contains data.
ALTER DATABASE AdventureWorks2012
ADD FILE (
NAME = Test1data,
FILENAME = 'C:\t1data.ndf',
SIZE = 5MB
);
GO
-- Empty the data file.
DBCC SHRINKFILE (Test1data, EMPTYFILE);
GO
-- Remove the data file from the database.
ALTER DATABASE AdventureWorks2012
REMOVE FILE Test1data;
GO

https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-shrinkfile-transact-sql

Azure Microsoft Office365

Azure Password Sync

Check your synchronization user security tab, or in domain properties if “Replicating Directory Changes” and “Replicating Directory Changes All” is checked.