Windows 10, Windows 11, Windows Server

Headless Display Emulator | Black Screen Fix



Intro

After using some RMM solutions over the years such as Datto RMM, ConnectWise Automate, and others I’ve run into an issue sometimes where I get a blank or black screen upon successful connection. These are always computers with no monitor attached but the issue does not occur for every endpoint without a monitor.

I’ve noticed this usually occurs with certain graphics drivers where a generic monitor driver is not loaded when a monitor is not attached, or configurations where the on-board integrated graphics controller is disabled in the BIOS for the primary use of a dedicated graphics card. Sometimes the on-board GPU loads a generic monitor driver when not screen is attached and the dedicated GPU driver does not.

A Hardware Solution

To solve this issue with a hardware solution one could use a different BIOS configuration if the on-board or integrated GPU is disabled, and enable it, or purchase a monitor emulator device. This little device makes the Windows OS believe there is a monitor attached and thus the blank or black screen issue when remoting to the device is resolved.

RDP (Remote Desktop Protocol) Solution

Another workaround for the blank or black screen issue is to use Remote Desktop to the device. Datto RMM, the ConnectWise Automate thick-client, and other RMM tools have the ability to RDP tunnel to the endpoints bypassing the no monitor attached bug.

A Software Solution

There can be cases where the physical location of the endpoint makes the hardware solution not a fast resolution. This led me to research a possible software solution and I did find one. I created a script that will accomplish this fix but it will not stick after the device reboots which is what I want.

This solution deploys USBMMIDD and you will see the following under “Display adapters” in Device Manager: USB Mobile Monitor Virtual Display when it’s active. Deploy this script to the device then remote to it again and you will will resolve the blank or black screen issue.

Install | PowerShell Script

PowerShell
# =========================
# Configuration Variables
# =========================
$WorkingDir      = "C:\TEMP"
$ZipFileName     = "usbmmidd_v2.zip"
$ZipPath         = Join-Path $WorkingDir $ZipFileName
$ExtractDir      = Join-Path $WorkingDir "usbmmidd_v2"
$InstallerSubDir = Join-Path $ExtractDir "usbmmidd_v2"
$URL             = "https://www.amyuni.com/downloads/usbmmidd_v2.zip"

# =========================
# Function Definitions
# =========================

function Download-Zip {
    param (
        [string]$URL,
        [string]$DestinationPath
    )

    Write-Host "Downloading file from $URL..."
    Invoke-WebRequest -Uri $URL -OutFile $DestinationPath
}

function Extract-Zip {
    param (
        [string]$ZipPath,
        [string]$ExtractTo
    )

    Write-Host "Extracting $ZipPath to $ExtractTo..."
    Expand-Archive -LiteralPath $ZipPath -DestinationPath $ExtractTo -Force -WarningAction SilentlyContinue
}

function Install-Driver {
    param (
        [string]$InstallerDirectory
    )

    Write-Host "Installing driver from $InstallerDirectory..."
    $OriginalLocation = Get-Location
    Set-Location -Path $InstallerDirectory

    # Determine processor architecture
    $Architecture = $env:PROCESSOR_ARCHITECTURE

    if ($Architecture -eq "AMD64") {
        Start-Process -FilePath ".\deviceinstaller64.exe" -ArgumentList "install usbmmidd.inf usbmmidd" -Wait
        Start-Process -FilePath ".\deviceinstaller64.exe" -ArgumentList "enableidd 1" -Wait
    } elseif ($Architecture -eq "x86") {
        Start-Process -FilePath ".\deviceinstaller.exe" -ArgumentList "install usbmmidd.inf usbmmidd" -Wait
        Start-Process -FilePath ".\deviceinstaller.exe" -ArgumentList "enableidd 1" -Wait
    } else {
        Write-Host "Unsupported architecture: $Architecture"
    }

    # Go back to original directory to avoid locking the folder
    Set-Location -Path $OriginalLocation
}

function Cleanup {
    param (
        [string]$ZipFile,
        [string]$ExtractFolder
    )

    Write-Host "Cleaning up files..."
    if (Test-Path $ZipFile) {
        Remove-Item -Path $ZipFile -Force -ErrorAction SilentlyContinue
    }

    if (Test-Path $ExtractFolder) {
        Remove-Item -Path $ExtractFolder -Recurse -Force -ErrorAction SilentlyContinue
    }
}

# =========================
# Main Script Execution
# =========================

# Ensure working directory exists
New-Item -Path $WorkingDir -ItemType Directory -Force -WarningAction SilentlyContinue -ErrorAction SilentlyContinue | Out-Null

Download-Zip -URL $URL -DestinationPath $ZipPath
Extract-Zip -ZipPath $ZipPath -ExtractTo $ExtractDir
Install-Driver -InstallerDirectory $InstallerSubDir
Cleanup -ZipFile $ZipPath -ExtractFolder $ExtractDir

Uninstall | PowerShell Script

You can uninstall the driver with the following script if you don’t want to reboot the endpoint for some reason.

PowerShell
# =========================
# Function Definitions
# =========================

function Uninstall-DevicesByDescription {
    param (
        [string]$DescriptionMatch
    )

    Write-Host "Searching for devices with description: '$DescriptionMatch'..."

    # Get all PnP devices (by friendly name match)
    $devices = Get-PnpDevice -FriendlyName "*$DescriptionMatch*" -ErrorAction SilentlyContinue

    if ($devices.Count -eq 0) {
        Write-Host "No matching devices found."
        return
    }

    foreach ($device in $devices) {
        Write-Host "Uninstalling device: $($device.FriendlyName) ($($device.InstanceId))"

        try {
            # Use pnputil to uninstall the device, without deleting the driver package
            $deviceInstanceId = $device.InstanceId
            pnputil.exe /remove-device $deviceInstanceId

            Write-Host "Successfully uninstalled device: $($device.FriendlyName)"
        } catch {
            Write-Warning "Failed to uninstall device: $($device.FriendlyName)"
        }
    }
}

# =========================
# Main Script Execution
# =========================

# Uninstall devices by matching description
Uninstall-DevicesByDescription -DescriptionMatch "USB Mobile Monitor Virtual Display"

Conclusion

I hope this helps someone out there that gets irritated when this happens.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *