Removing an Office 365 Tenancy

There may be a reason you wish to totally remove an Office 365 tenancy. In our case, it was that the company we looked after was sold. They wanted the data removed – and quickly.

It is possible now to totally remove a tenancy following these steps:

  1. Remove any licensing from the Office 365 tenancy
  2. Open Powershell
  3. Connect to Azure AD by typing
    Connect-AzureAD

    If this doesn’t work, you may need to install AzureAD. Do this by typing

    Install-Module -Name AzureAD
  4. Once connected, you need to connect to Active Directory or mosl. To do this type
    Connect-MsolService

    If this does not work, you may need to install msol. Do this by typing

    Install-Module -Name Connect-MsolService
  5. Disable dirsync with the following command, if enabled
    Set-MsolDirSyncEnabled -EnableDirSync $false

    This command will take around 30 minutes for all users to become in cloud users

  6. You now need to remove all users and remove them from the recycle bin. Type
    Get-MsolUser | Remove-MsolUser -Force

    Then after waiting 30 minutes or so, type the following

    Get-MsolUser -ReturnDeletedUsers | Remove-MsolUser -RemoveFromRecycleBin -Force

    This command removes the deleted users from the AD recycle bin

  7. The next script will remove all of the enterprise applications in AD. This needs to be done
    $ObjectIds = (Get-AzureADServicePrincipal).ObjectIdFor ($i=0; $i -lt $ObjectIds.Length; $i++){ Remove-AzureADServicePrincipal -objectid $ObjectIds[$i]}
  8. Once these commands are completed, you can check Azure Active Directory by going to https://aad.portal.azure.com. Select Azure Active Directory and try to delete it. You will get something like the following. In this case, once the licenses have expired (these we removed 12 hours ago) you will be able to delete the tenancy.

For more information check out the following links:

RemoteApp Slow after Windows10 1803 update on Server 2012 R2

As the title suggests, after updating Windows 10 computers to 1803, users have reported slow RemoteApp sessions.

You can try disabling Remote FX, but user reports suggest this causes further issues.

The easiest fix is to copy mstsc.exe and mstscax.dll from a 1709 build and replace the files on 1803. We have confirmed this works.

KB4103727 Breaks RDP/Remote Desktop Gateway

This morning we awoke to screams from users not being able to login to our remote desktop servers.

KB4103727 has been released which switches a flag to protect against the CredSSP attack.

The quickest way to fix this to get your users working is to patch your domain controller with the May updates and use group policy to push out a change

You can manually add this to the registry for desktop clients

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters] "AllowEncryptionOracle"=dword:00000002

or via command line

reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters" /f /v AllowEncryptionOracle /t REG_DWORD /d 2

To fix this problem, the May updates need to be installed on all servers and workstations.

More information:

 

Patch Tuesday: CVE-2017-11826 Microsoft Office

There is an in-the-wild exploit for Microsoft Office. A patch has been released. This exploit has turned up on Virtus Total today.

A remote code execution vulnerability exists in Microsoft Office software when the software fails to properly handle objects in memory. An attacker who successfully exploited the vulnerability could run arbitrary code in the context of the current user. If the current user is logged on with administrative user rights, an attacker could take control of the affected system. An attacker could then install programs; view, change, or delete data; or create new accounts with full user rights. Users whose accounts are configured to have fewer user rights on the system could be less impacted than users who operate with administrative user rights.

Exploitation of the vulnerability requires that a user open a specially crafted file with an affected version of Microsoft Office software. In an email attack scenario, an attacker could exploit the vulnerability by sending the specially crafted file to the user and convincing the user to open the file. In a web-based attack scenario, an attacker could host a website (or leverage a compromised website that accepts or hosts user-provided content) containing a specially crafted file designed to exploit the vulnerability. An attacker would have no way to force users to visit the website. Instead, an attacker would have to convince users to click a link, typically by way of an enticement in an email or instant message, and then convince them to open the specially crafted file.

Patch Tuesday: KB4041691 & KB4041676 gona ruin your day

Microsoft has made a bit of a boo-boo this week. Hopefully, you haven’t auto approved patches this week.

KB4041691 and KB4041676 were pushed as delta updates through WSUS. First published on Twitter, but now there is a Reddit thread on the issue https://www.reddit.com/r/sysadmin/comments/75o0oq/windows_security_updates_broke_30_of_our_machines/

If you run into this issue, you will need to boot into WinRE and use DISM to remove the update.

With all updates from Microsoft lately, I recommend you lab them first. Don’t take the risk.

User Device Registration Event ID 304 307

With Server 2016, we’ve been getting a lot of these errors in the event log

This is caused by a task called Automatic-Device-Join which runs as a scheduled task whenever someone logs into a server (terminal server). This can cause a lot of events on the system.

Disable this task. This is used for Azure AD device joins. No idea why this is enabled by default.

OfficeBackgroundTaskHandlerRegistration Flashes a black CMD window every hour

This is an annoying issue I’ve been trying to find the answer to for a couple of days.

I get a quick flash on my screen with a black box which looks like a command window. I finally had this happen on a slow enough computer where I could see where it was running from. See below.

To fix this issue, do the following:

  1. Open task scheduler from the start menu
  2. Find Microsoft Office under tasks
  3. Disable OfficeBackgroundTaskHandlerRegistration

A fix from Microsoft on this issue is underway.

Veeam cannot see ReFS 3.1 volumes in backup (Server 2012 R2)

We had a problem recent where Veeam 9.5 which was installed on Windows 2012 R2 trying to restore from Exchange 2016 on Server 2016 with ReFS datastores.

It turns out, Server 2012 R2 cannot recognise ReFS 3.1 which is on Server 2016. From the screenshot below, this backup is missing two drives which are ReFS:

When logging in to the Exchange server, you will see the correct drives

To fix this you really only have one option: Install Veeam B&R on Server 2016, or at the bare minimum, the mount points on Server 2016.

Once you have a Server 2016 mount point, you will be able to see the ReFS drives.

Method ‘Upgrade’ in type ‘Microsoft.SharePoint.WorkflowServices.WorkflowServiceApplicationProxy’ Sharepoint 2013 pre SP1

We have an old install of Sharepoint 2013 which has the March 2013 PU installed. A bunch of security updates slipped through which patched Sharepoint. You will get the following error:

Method 'Upgrade' in type 'Microsoft.SharePoint.WorkflowServices.WorkflowServiceApplicationProxy' from assembly 'Microsoft.SharePoint.WorkflowServices, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' does not have an implementation.

This is apparently caused by newer security updates shipping with Sharepoint 2013 SP1 dll files. In order to fix this issue, download and install KB2880963. The install may take some time.