This blog contains contributions from Technical Architect, Kamran Ahmad, and System Engineer Level 1, Doug Lampone.
We recently assisted a client with a Microsoft OneDrive issue where users were not automatically signed into OneDrive through Azure RemoteApp or Azure Virtual Desktop. The client's resources were hosted on Windows 11 version 22H2 running OneDrive 24.166.0818.0003. To come up with a solution to this problem, we worked with Microsoft support and captured logs. We found the following errors:
Error: 6i0ht = msa_wam_find_accounts_error
error 80070005 = E_ACCESSDENIED error trying to GetAccounts.
7q6cj = DRX_E_AUTH2_ONEAUTH_MSAL_NO_NETWORK due to error 0xcaa70004 -895025148 ERROR_INET_RESOURCE_NOT_FOUND The server or proxy was not found.
Error: 5akgo = No WAM provider available.
With the help of Microsoft and various teams at the client site, we created a workaround by creating two scheduled tasks.
- Task one starts OneDrive in the background by using the /background switch that runs every time a user logins.
- Task two runs a script that installs the Microsoft.AAD.BrokerPlugin AppxPackage, which runs every time a user logs in.
The commands for the script were created to address Microsoft Web Account Manager (WAM) errors. The script checks to see if the WAM plugin is installed and begins an installation if not. These two scheduled tasks resolved the WAM errors seen in the logs and the OneDrive Auto Sign-on issue. If you’re having issues with OneDrive AutoSign-in, see the sample script below.
# Define the log file path
$logFile = "C:\Temp\AADBrokerLogFile.log"
# Function to log messages
function Log-Message {
param (
[string]$message
)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$logEntry = "$timestamp - $message"
$logEntry | Out-File -FilePath $logFile -Append
}
# Check if the package is installed
if (-not (Get-AppxPackage Microsoft.AAD.BrokerPlugin)) {
# Log that the package is not installed
Log-Message "Microsoft.AAD.BrokerPlugin not found. Attempting to add the package."
# Attempt to add the package
try {
Add-AppxPackage -Register "$env:windir\SystemApps\Microsoft.AAD.BrokerPlugin_cw5n1h2txyewy\Appxmanifest.xml" -DisableDevelopmentMode -ForceApplicationShutdown
Log-Message "Successfully added Microsoft.AAD.BrokerPlugin."
} catch {
Log-Message "Failed to add Microsoft.AAD.BrokerPlugin. Error: $_"
}
} else {
# Log that the package is already installed
Log-Message "Microsoft.AAD.BrokerPlugin is already installed."
}
# Log the current status of the package
try {
$package = Get-AppxPackage Microsoft.AAD.BrokerPlugin
if ($package) {
Log-Message "Current status of Microsoft.AAD.BrokerPlugin: Installed."
} else {
Log-Message "Microsoft.AAD.BrokerPlugin is not installed."
}
} catch {
Log-Message "Error retrieving the status of Microsoft.AAD.BrokerPlugin. Error: $_"
}