TechShizz | Tech Guides

Enable ports for remote management for Server Manager


You are unable to remotly manage a server using server administrator getiing a DCOM and Remote Event Management firewall error.


The firewall on the remote computer is not configured to allow remote management of the server.


You can run this PowerShell command to enable the rules on all servers in one command.

Import-Module NetSecurity

Invoke-Command Server1,Server2,Server3 {Get-NetFireWallRule *COM* | Enable-NetFirewallRule}

Invoke-Command Server1,Server2,Server3 {Get-NetFireWallRule *RemoteEvent* | Enable-NetFirewallRule}‚Äč

HTTP Error 503 when Single Sin On redirecting to ADFS Server After Re-Enabling Single Sign On


An Office 365 single sign on environment has been disabled (due to server being offline for an extended period of time) and on trying to re-enable Single Sign on is not working. Specifically, when being re-directed from the Office 365 portal to the federated server you get a http 503 error.  Also you may have noticed the token signing certificates in ADFS have exired.


The proxy trust certificate is a rolling certificate valid for 2 weeks and periodically updated. If the servers are offline for more than two weeks the ADFS server will lose its trust relationship with the ADFS Proxy server. 


The certificates that had expired needed to be re-newed. To do this we simply ran the Azure AD Connect tool on the ADFS server. Once this was run, we noticed the expired certificates has been renewed.

Second, we need to install the new ADFS certificate thumbprint in the ADFS Proxy Server (Web Appication Proxy). To do this, on the ADFS server we ran:


and noted the thumprint for the new certificate

On the ADFS Proxy Server (Web Application Proxy) we ran:

Install-WebApplicationProxy -CertificateThumbprint "22121D02DCBF80F440B5E26D52B92BC255D59F95" -FederationServiceName ""

We then had to enter the DOMAIN credentials. 

Reference, Links and Imges

Customise Office 365 Encrypted Email Notification

You need to customize the Encrypted email notification that is sent to the recipient of an encrypted email so suit the company's branding/image.

Connect to the Office 365 Tenant via the Azure PowerShell Module. Use these commands

Set-OMEConfiguration -Identity "OME Configuration" -EmailText "Encrypted message from CompanyName secure messaging system."

Set-OMEConfiguration -Identity "OME Configuration" -DisclaimerText "This message is confidential for the use of the addressee only."

#Text that appears at the top of the encrypted mail viewing portal:
Set-OMEConfiguration -Identity "OME Configuration" -PortalText "CompanyName secure email portal."

Set-OMEConfiguration -Identity "OME configuration" -Image (Get-Content "C:\Users\%username%\Desktop\logo.png" –Encoding byte)
#Supported file formats: .png, .jpg, .bmp, or .tiff
#Optimal size of logo file: less than 40 KB
#Optimal size of logo image: 170x70 pixels

#Background color:
Set-OMEConfiguration -Identity "OME Configuration" -BackgroundColor "#ffffff"

One Drive character limit | PowerShell to find file path character length | File Path Character Limit


One Drive will not sync files with more than 400 charactes in the file path




Use this script and execute to create a list of all files and their number of characters. Address by shortening folder and file names. 

 $pathToScan = "C:\APP1-Data\SharePointData\MW\MW - Documents" # The path to scan and the the lengths for (sub-directories will be scanned as well).
$outputFilePath = "C:\temp\PathLengths.txt" # This must be a file in a directory that exists and does not require admin rights to write to.
$writeToConsoleAsWell = $true # Writing to the console will be much slower.

# Open a new file stream (nice and fast) and write all the paths and their lengths to it.
$outputFileDirectory = Split-Path $outputFilePath -Parent
if (!(Test-Path $outputFileDirectory)) { New-Item $outputFileDirectory -ItemType Directory }
$stream = New-Object System.IO.StreamWriter($outputFilePath, $false)
Get-ChildItem -Path $pathToScan -Recurse -Force | Select-Object -Property FullName, @{Name="FullNameLength";Expression={($_.FullName.Length)}} | Sort-Object -Property FullNameLength -Descending | ForEach-Object {
$filePath = $_.FullName
$length = $_.FullNameLength
$string = "$length : $filePath"

# Write to the Console.
if ($writeToConsoleAsWell) { Write-Host $string }

#Write to the file.

Disable Autodiscover for Office 365 Migration

When migrating to Office 365 the internal outlook users are not able to use autodiscover.

This is because the internal exchange server also uses autodiscover in IIS.

Use this description to remove the internal AutodiscoverVirtualDirectory

Be sure that this is the proper migration plan for you’re organization!

1. Open an elevated command prompt and back-up the IIS configuration (Just in case !):

cd %windir%system32inetsrvappcmd.exe add backup “Before Removing Autodiscover”

2. Open an elevated Exchange Management Shell and retrieve the current autodiscover virtual directory:

Get-AutodiscoverVirtualDirectory | fl Name, Server, InternalUrl, Identity

Copy the Identity value to the clipboard.

3. In the Exchange Management Shell, remove the autodiscover virtual directory:

Remove-AutodiscoverVirtualDirectory -Identity “ALPHAAutodiscover (Default Web Site)”

When you’re identity contains a space, use the quotation marks ”

You will have to confirm by typing a “Y”.

4. Check that the autodiscover virtual directory is gone:

Get-AutodiscoverVirtualDirectory | fl Name, Server, InternalUrl, Identity

This should now return nothing.

5. Now, with Outlook running on a desktop, hold the Ctrl button, right-click on the Outlook icon in the system tray, and select Test E-mail AutoConfiguration. Enter your email address and password and click the Test button. The results should come from the Office 365 server.