How to Fix a Windows MTR Device Not Onboarding in Microsoft Teams Admin Center and Rooms Pro Management

While playing with a Windows MTR, I noticed it was not being onboarded and was not available in the Microsoft Teams Admin Center, neither in the Microsoft Teams Rooms Pro Management portal.

After waiting a few days for it to show up, I decided to investigate further the reason why it was not being detected.

Win Device Admin Agent Service

Check the Win Device Admin Agent Service status

Devices are enrolled by the Win Device Admin Agent Service, so the first step on your device is to check if the service exists and if it is running.

  1. On the MTR tap … More and then Settings
    Win Device Admin Agent Service
  2. Authenticate using the Administrator account
    Note: The default password for Windows MTRs is sfb. Consider to change it once the configuration is finished.
  3. Once in the Settings, click on Windows Settings to open the Administrator account on Windows
    Win Device Admin Agent Service
  4. Authenticate on Windows again using the administrator account
  5. Press the Start button and search for Services
    Win Device Admin Agent Service
  6. Open the Services application and check if the Win Device Admin Agent Service exits
    Win Device Admin Agent Service
  7. If it exists and is not running, start it
  8. If it does not exist check the Restore the Win Device Admin Agent Service section

Restart the MTR and in a few minutes, you should see it onboard on TAC if you are using a Basic Teams Room License and in the Microsoft Teams Rooms Pro Management Portal if you are using a Pro License

Win Device Admin Agent Service

Restore the Win Device Admin Agent Service

In my case, the Win Device Admin Agent Service was nonexistent which means that it needs to be restored/created. Thankfully, Fabio Gross a Microsoft Tech community user built a PowerShell script that restores the service like a charm.

If you are facing this situation do the following:

  1. Copy the following script and save it as a PS1 file on your MTR device
    $AARegistryPath = "HKLM:\SOFTWARE\Microsoft\PPI\SkypeSettings\INSTALL_AA"
    $registryKey = "EnableAAInstall"
    $SRSUser = "Skype"
    $SRSPackage = "Microsoft.SkypeRoomSystem"
    $AgentBinaryName = "WinAgentSvc.exe"
    $ServiceName = "WinDeviceAdminAgent"
    $ServiceDisplayName = "Win Device Admin Agent"
    $ServiceDescription = "Teams Admin Agent for Microsoft Teams Room"
    
    function Join-Paths2 {
        $path = $args[0]
        $args[1..$args.Count] | ForEach-Object { $path = Join-Path $path $_ }
        $path
    }
    
    function Get-IsAdminAgentInstallationEnabled {
        $IsEnableAAInstallSet = $true;
        if (Test-Path -Path $AARegistryPath) {
            $registry = Get-Item -path $AARegistryPath -ErrorAction SilentlyContinue
            if ($null -ne $registry) {
                try {
                    $IsEnableAAInstallSet = ([bool]::Parse($registry.GetValue($registryKey, $true)))
                }
                catch {
                }
            }
        }
    
        return $IsEnableAAInstallSet
    }
    
    function Get-SRSInstallPath {
        $installPath = ""
    
        $user = $SRSUser
        $packageName = $SRSPackage
        $package = Get-AppxPackage -User $user -Name $packageName
    
        if ($null -ne $package) {
            $installPath = $package.InstallLocation
        }
    
        return $installPath
    }
    
    function Get-AdminAgentVersionInFolder {
        param(
            [parameter(Mandatory = $true)]
            [string]$FolderPath
        )
    
        $version = $null
        $serviceFilePath = Join-Path $FolderPath $AgentBinaryName
    
        if (Test-Path -Path $serviceFilePath) {
            try {
                $version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($serviceFilePath).FileVersion
            }
            catch {
                Write-Error -Message "Cannot find admin agent version in path $FolderPath" -Exception $_.Exception
            }
        }
    
        return $version
    }
    
    function CreateServiceUsingServiceController {
        param(
            [parameter(Mandatory = $true)]
            [string]$ServiceFilePath
        )
    
        $processArgs = "create $ServiceName binPath=""\""$ServiceFilePath\"""" start=auto DisplayName=""$ServiceDisplayName"""
        $process = [System.Diagnostics.Process]::Start("sc.exe", $processArgs)
        $process.WaitForExit();
    }
    
    $DefaultAgentInstallPath = Join-Paths2 ${env:SystemDrive} "Program Files" "AdminAgent"
    
    # Must be running as admin
    $isElevated = "non-elevated"
    if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
        $isElevated = "elevated"
    }
    
    if ($isElevated -ne "elevated") {
        Write-Output "This script must be run with administrative privileges. Use an elevated command prompt."
        exit 1
    }
    
    $IsAgentInstallationEnabled = Get-IsAdminAgentInstallationEnabled
    if ($IsAgentInstallationEnabled -eq $false) {
        Write-Output "Admin Agent installation is disabled in the registry."
        Write-Output "Removing registry key: $AARegistryPath"
        Remove-Item -Path $AARegistryPath -Recurse
        Write-Output "Admin Agent installation is now enabled."
    }
    
    Write-Output "Checking if service ""$ServiceDisplayName"" is already installed and running ..."
    
    # If agent is installed, service must be in stopped state
    $AgentService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
    if ($null -ne $AgentService -and $AgentService.Status -ne [System.ServiceProcess.ServiceControllerStatus]::Stopped) {
        Write-Output "The service ""$AgentService.DisplayName"" must be stopped for repair."
        Write-Output "Please stop the service using the Powershell command:"
        Write-Output "Stop-Service -Name ""$ServiceName"""
    
        exit 1
    }
    
    Write-Output "Service ""$ServiceDisplayName"" is not present"
    
    Write-Output "Checking for package $SRSPackage ..."
    $SRSInstallPath = Get-SRSInstallPath
    # Check if the agent source path is available and valid
    if (($null -eq $SRSInstallPath) -or ($SRSInstallPath.Length -eq 0)) {
        Write-Output "Skype Room System is not installed. This app must be installed for this script to proceed. Please install this app and run this script again if the issue persists."
        exit 1
    }
    
    if (-not (Test-Path -Path $SRSInstallPath)) {
        Write-Output "The path ""$SRSInstallPath"" is not valid. This path must exist."
        exit 1
    }
    
    Write-Output "The package ""$SRSPackage"" is present."
    
    $AgentSourceDirectory = Join-Path $SRSInstallPath "Scripts\\AdminAgent"
    if (-not (Test-Path -Path $AgentSourceDirectory)) {
        Write-Output "Unable to find the path ""$AgentSourceDirectory"". Cannot proceed with the repair."
        exit 1
    }
    
    # Check if we have a valid version of admin agent in the source folder
    $AgentSourceVersion = Get-AdminAgentVersionInFolder -FolderPath $AgentSourceDirectory
    if ($null -eq $AgentSourceVersion) {
        Write-Output "Cannot find version information of admin agent in source folder. Cannot proceed with the repair."
        exit 1
    }
    
    Write-Output "Found Admin Agent version $AgentSourceVersion bundled in the package."
    
    $AgentInstallPath = $DefaultAgentInstallPath
    
    Write-Output "Checking for existing installations at ""$AgentInstallPath""."
    
    # Remove older installations
    if (Test-Path -Path $AgentInstallPath) {
        Write-Output "Removing existing installation at ""$AgentInstallPath""..."
        Remove-Item "$AgentInstallPath\\*.*" -Recurse
        Start-Sleep -Seconds 2
        Remove-Item $AgentInstallPath -Recurse
        Start-Sleep -Seconds 2
    }
    
    # Copy admin agent binaries
    if (-not (Test-Path -Path $AgentInstallPath)) {
        Write-Output "Creating folder ""$AgentInstallPath""."
        New-Item -Path $AgentInstallPath -ItemType Directory
    }
    
    Write-Output "Copying files for Admin Agent..."
    Copy-Item -Path $AgentSourceDirectory\* -Destination $AgentInstallPath -Recurse
    Write-Output "Admin Agent files copied."
    
    $AgentService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
    
    # Delete existing service registration if present
    if ($null -ne $AgentService) {
        Write-Output "Removing existing service registration for $ServiceDisplayName"
        sc.exe delete $ServiceName
    }
    
    $AgentService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
    # Create a new service if required
    if ($null -eq $AgentService) {
        Write-Output "Registering service $ServiceDisplayName"
        $serviceFilePath = Join-Path $AgentInstallPath $AgentBinaryName
        CreateServiceUsingServiceController -ServiceFilePath $serviceFilePath
        sc.exe failure $ServiceName reset=600 actions=restart/60000/restart/120000/restart/240000
    }
    else {
        Write-Output "W: Service registration not removed"
    }
    
    Write-Output "Starting service ""$ServiceName"""
    # Start the service
    sc.exe start $ServiceName
    
    Write-Output "Repair is complete"
    
  2. On the MTR open the Terminal as an administrator
  3. Change the PowerShell execution Policy to allow you to execute unsigned scripts, you can learn more about it here.
  4. Execute the script and wait for it to finish
    Win Device Admin Agent Service
  5. Restart the MTR and in a few minutes, you should see it onboard on TAC if you are using a Basic Teams Room License and in the Microsoft Teams Rooms Pro Management Portal if you are using a Pro License

Win Device Admin Agent Service


No comments yet

Leave a Reply


I've been working with Microsoft Technologies over the last ten years, mainly focused on creating collaboration and productivity solutions that drive the adoption of Microsoft Modern Workplace.

%d bloggers like this: