TechShizz | All posts by rich

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.

Custom bullet points / Unordered Lists HTML

If we want to use a custome image for bullet points in html we can make this work with a bit of CSS.
ul.myclass {
list-style-image: url('/images/custom_bullet.jpg');
<ul class="myclass">
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>