Showing posts with label Exchange 2016. Show all posts
Showing posts with label Exchange 2016. Show all posts

Saturday, January 12, 2019

[EX16] Script to send test message with attachment


Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin -erroraction silentlyContinue
$file = "C:\Users\admin\Desktop\f2.zip"
get-mailbox -organizationalunit "formula one" | % {Send-MailMessage -SmtpServer exhub.domain.int -To $_.primarysmtpaddress -From senna@domain.com -Subject “SUBJECT HERE” -Body “BODY HERE” -attachment $file}

[EX16] Correct UPN to match Smtp


$ggg = Get-Mailbox -OrganizationalUnit "formula indy"
$ggg | % {Set-Mailbox -Identity $_ -UserPrincipalName  $_.primarysmtpaddress}

Monday, August 6, 2018

[EX10] Check Send-As Permissions



Finding all users who have Send-As :

Get-Mailbox -Resultsize Unlimited | Get-ADPermission | ? {($_.ExtendedRights -like "*send-as*") -and -not
($_.User -like "nt authorityself")} | ft Identity, User -auto

Find out who a particular user can Send-As:

Get-Mailbox -Resultsize Unlimited | Get-ADPermission | ? {($_.ExtendedRights -like "*send-as*") -and -not
($_.User -like "nt authorityself") -and ($_.User -like "DOMAINUsernameUwantToFind")} | ft Identity, User -auto

Find all users who have Full Access to the mailbox of others:

Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | ? {($_.AccessRights -match "FullAccess") -and 
not ($_.User -like "NT AUTHORITYSELF")} | ft Identity, User

Add Full Access without Auto-Mapping:

Add-MailboxPermission -Identity JeroenC -User 'Mark Steele' -AccessRight FullAccess -InheritanceType All -Automapping $false


"This example removes auto-mapping on an existing shared mailbox and removes the auto-mapping behavior for users who have already been granted Full Access permissions."

$FixAutoMapping = Get-MailboxPermission sharedmailbox |where {$_.AccessRights -eq "FullAccess" -and $_.IsInherited -eq $false}
$FixAutoMapping | Remove-MailboxPermission
$FixAutoMapping | ForEach {Add-MailboxPermission -Identity $_.Identity -User $_.User -AccessRights:FullAccess -AutoMapping $false}

Wednesday, January 31, 2018

[EX2016] Enable HTTP Strict Transport Security (HSTS)



In IIS, we can add a new header for our site, though, we can also set the response header at the server or folder level if necessary.
  • Open IIS Manager and select the site
  • Double-click on the HTTP Response Headers
  • Click Add…
  • Set the name to: Strict-Transport-Security
  • Set the value to: max-age=10886400 then click OK

Sunday, August 27, 2017

[WSRV] Script to Block .Net 4.7


$registryPath = "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\WU"
New-Item -Path $registryPath -Force | Out-Null
$Name = "BlockNetFramework47"
$value = "1"
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null

Sunday, July 23, 2017

[EX2013] Deploy MaxConcurrentApi



# deploy MaxConcurrentApi key in multiple Exchange servers
Get-Exchangeserver | foreach{Invoke-Command -ComputerName $_.fqdn -ScriptBlock {
    $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters"
    $Name = "MaxConcurrentApi"
    $value = "10"

    IF(!(Test-Path $registryPath)){
        New-Item -Path $registryPath -Force | Out-Null
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}
    ELSE {
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}

    restart-service netlogon -Force
}}

# deploy MaxConcurrentApi key in multiple DC servers. This is captured from the “currentDomainControllers” result.
(Get-Exchangeserver servername -Status).CurrentDomainControllers | foreach{Invoke-Command -ComputerName $_ -ScriptBlock {
    $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters"
    $Name = "MaxConcurrentApi"
    $value = "10"

    IF(!(Test-Path $registryPath)){
        New-Item -Path $registryPath -Force | Out-Null
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}
    ELSE {
        New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null}

    restart-service netlogon -Force
}}

Wednesday, March 1, 2017

[EX2013] Default folder is missing



Use the steps below to confirm that you are facing this issue, and to reset the PR_ATTR_HIDDEN property of the affected folder.

  1. Download and extract the MFCMAPI tool from http://mfcmapi.codeplex.com.
  2. Launch mfcmapi.exe and click OK through the intro screen.
  3. On the Session menu, click Logon.
  4. Select the Outlook profile for the affected mailbox, and click OK.
  5. Double-click the email address which represents the desired mailbox.
  6. In the left pane, navigate to the affected folder using the appropriate steps below for the type of Outlook profile you are using.

    Cached Mode
    1. Expand Root - Mailbox
    2. Expand IPM_SUBTREE


    Online Mode

    1. Expand Root Container
    2. Expand Top of information Store
  7. Locate and select the folder that appears missing in Outlook, and check the value of the PR_ATTR_HIDDEN to determine if it is set to True, as shown in the following figure:


  8. If PR_ATTR_HIDDEN shows a value of True, right-click the PR_ATTR_HIDDEN property and select Edit Property.
  9. Uncheck the Boolean checkbox and click OK.
  10. Close all MFCMAPI windows, and restart Outlook.


While you are looking at the folder properties you should also check PR_ATTR_SYSTEM. Its default value is also False, so if you find it currently set to True, after completing steps 1 through 9 above, you should change this value as well, using the additional steps below.
  1. If PR_ATTR_SYSTEM shows a value of True, right-click the PR_ATTR_SYSTEM property and select Edit Property.
  2. Uncheck the Boolean checkbox and click OK.
  3. Close all MFCMAPI windows, and restart Outlook.




https://support.microsoft.com/en-us/help/2992093/

Sunday, December 18, 2016

[WSRV] Prevent Truncation of Long Output

Check with:


$FormatEnumerationLimit


Modify to unlimited:


$FormatEnumerationLimit =-1

Thursday, March 3, 2016

[WSRV] Check which .NET Framework versions are installed


CMDLET:

Get-ItemProperty -Path “HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full” | Format-List Release



https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx



  1. On the Start menu, choose Run.
  2. In the Open box, enter regedit.exe.
    You must have administrative credentials to run regedit.exe.
  3. In the Registry Editor, open the following subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
    Note that the path to the Full subkey includes the subkey Net Framework rather than .NET Framework.
    System_CAPS_noteNote
    If the Full subkey is not present, then you do not have the .NET Framework 4.5 or later installed.
    Check for a DWORD value named Release. The existence of the Release DWORD indicates that the .NET Framework 4.5 or newer has been installed on that computer.


  1. The value of the Release DWORD indicates which version of the .NET Framework is installed.
    Important
    The following table lists the keys of released versions of the .NET Framework only. It doesn't list the keys of preview or pre-release versions.
Value of the Release DWORD
Version
378389
.NET Framework 4.5
378675
.NET Framework 4.5.1 installed with Windows 8.1 or Windows Server 2012 R2
378758
.NET Framework 4.5.1 installed on Windows 8, Windows 7 SP1, or Windows Vista SP2
379893
.NET Framework 4.5.2
On Windows 10 systems only: 393295

On all other OS versions: 393297
.NET Framework 4.6
On Windows 10 November Update systems only: 394254

On all other OS versions: 394271
.NET Framework 4.6.1
On Windows 10 Anniversary Update and Windows Server 2016: 394802

On all other OS versions: 394806
.NET Framework 4.6.2
On Windows 10 Creators Update only: 460798

On all other OS versions: 460805
.NET Framework 4.7
On Windows 10 Fall Creators Update only: 461308

On all other OS versions: 461310
.NET Framework 4.7.1
On Windows 10 April 2018 Update only: 461808

On all other OS versions: 461814
.NET Framework 4.7.2

[EX2010] Configure TLS Certificate for Receive Connectors




Get-ExchangeCertificate


$cert = Get-ExchangeCertificate -Thumbprint E67EC3C8D679AA35D17678FEC51907272B1BAE2

$tlscertificatename = "<i>$($cert.Issuer)<s>$($cert.Subject)"

Set-ReceiveConnector "EX2016SRV1\Client Frontend EX2016SRV1" -TlsCertificateName $tlscertificatename

Tuesday, February 2, 2016

[EX2016] Pre-requisites

Exchange 2016

  • Mailbox (2012 R2)

Install-WindowsFeature RSAT-ADDS, AS-HTTP-Activation, Desktop-Experience, NET-Framework-45-Features, RPC-over-HTTP-proxy, RSAT-Clustering, RSAT-Clustering-CmdInterface, RSAT-Clustering-Mgmt, RSAT-Clustering-PowerShell, Web-Mgmt-Console, WAS-Process-Model, Web-Asp-Net45, Web-Basic-Auth, Web-Client-Auth, Web-Digest-Auth, Web-Dir-Browsing, Web-Dyn-Compression, Web-Http-Errors, Web-Http-Logging, Web-Http-Redirect, Web-Http-Tracing, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Lgcy-Mgmt-Console, Web-Metabase, Web-Mgmt-Console, Web-Mgmt-Service, Web-Net-Ext45, Web-Request-Monitor, Web-Server, Web-Stat-Compression, Web-Static-Content, Web-Windows-Auth, Web-WMI, Windows-Identity-Foundation, RSAT-DNS-Server, GPMC, Telnet-Client

.NET Framework 4.5.2
https://www.microsoft.com/en-us/download/details.aspx?id=42642

Unified Communications Managed API 4.0 Runtime



  • Edge Transport (2012 R2)

Install-WindowsFeature ADLDS

After you've installed the operating system roles and features, install .NET Framework 4.5.2
https://www.microsoft.com/en-us/download/details.aspx?id=42642