Home > Mobile >  The taskbar freezes after clicking to language bar on windows 11 (keyboard added via PowerShell)
The taskbar freezes after clicking to language bar on windows 11 (keyboard added via PowerShell)

Time:01-26

Good day! My goal is to add a keyboard for new users in the domain using logon PowerShell script. Here is the PowerShell code:

$LanguageList = Get-WinUserLanguageList
$LanguageList.Add("ru-RU")
Set-WinUserLanguageList $LanguageList -Force

Keyboard added successfully, however i cannot click to the language bar. I can only change language using key combination. Interesting that after clicking to the language bar, the taskbar and some windows UI is stuck except explorer until i click to the desktop or to explorer.

After this the error in the event viewer appears: "Activation for Microsoft.Windows.ShellExperienceHost_cw5n1h2txyewy!App failed. Error code: Class not registered. Activation phase: No phase defined"

I also tried to add the keyboard by adding a record in registry "Keyboard Layaout\Preload". But in case if i add a custom keyboard layout, the above behavior appears too. And i like above method because the keyboard also appears in settings, not only in language bar.

If i delete keyboard added from above logon script and add it again through interface, everything works fine.

Above code works fine if run it directly in PowerShell for logged on user.

Do you have any idea about overcoming this?

Thank you in advance.

Alex

CodePudding user response:

Found the solution here in the last post:

Error with Windows Shell Experience and Cortana

After running following script, the task bar works as usual for all users in the machine. It needs to be ran every time after the domain user is deleted.

taskkill /F /IM explorer.exe 
taskkill /F /IM ShellExperienceHost.exe
taskkill /F /IM StartMenuExperiencehost.exe 
taskkill /F /IM SearchUI.exe 
taskkill /F /IM RunTimeBroker.exe 
Start-Sleep 3 
cd $Env:localappdata\Packages\Microsoft.Windows.ShellExperienceHost_cw5n1h2txyewy 
Remove-Item -Recurse -Force .\TempState\ 
cd $Env:localappdata\Packages\Microsoft.Windows.StartMenuExperiencehost_cw5n1h2txyewy 
Remove-Item -Recurse -Force .\TempState\ 
cd $Env:localappdata\Packages\Microsoft.Windows.Cortana_cw5n1h2txyewy 
Remove-Item -Recurse -Force .\TempState\ 
Add-AppxPackage -register "C:\Windows\SystemApps\ShellExperienceHost_cw5n1h2txyewy\AppxManifest.xml" -DisableDevelopmentMode 
Add-AppxPackage -register "C:\Windows\SystemApps\StartMenuExperiencehost_cw5n1h2txyewy\AppxManifest.xml" -DisableDevelopmentMode 
Add-AppxPackage -register "C:\Windows\SystemApps\Microsoft.Windows.Cortana_cw5n1h2txyewy\AppxManifest.xml" -DisableDevelopmentMode
Start-Sleep 3 
Start-Process "RunTimeBroker.exe"
Start-Process "SearchUI.exe"
Start-Process "StartMenuExperiencehost.exe"
Start-Process "ShellExperienceHost.exe"
Start-Process "explorer.exe"
  • Related