Fixing “Open Shell needs to configure itself”

If you use Open Shell (the replacement for Classic Shell) every time you upgrade Windows your users will get hit with the message “Open Shell needs to configure itself for the new operating system”.   If you are not an administrator on the machine, you will be prompted to enter an admin name and password in order to make the necessary changes.  If you are like me you hopefully have your users restricted to protect them from the internet and themselves.  If you do, then they will get this message over and over again until an administrator signs on and fixes the issue.

I have an easier way that I have used for some time now with Classic Shell.  I have rewritten the script to work with Open Shell.  Run this however you want. If you use SCCM you can run this after Windows has upgraded in your Task Sequence or as a separate Task Sequence that runs after an upgrade. If you are on a domain, you can just push out the registry key with the correct value and ONLY apply the GPO to the correct version of Windows 10. Each version will have a different value. This must be ran as an admin or as system for it to make the needed registry changes.

@echo off
rem * ---------------------------------------------------------------------------------------------------------------------
rem * ######################################################################################
rem * # AUTHOR  : Mark Scarberry - https://technology.wayneschoolswv.org                   #
rem * # DATE    : 02-20-2019                                                               #
rem * # COMMENT : Automated repair of Open Shell issue due to upgrading Windows.           #
rem * #           Checks and changes registry value based on Windows Build number          #
rem * #           Tested up to Windows 1809 on Open Shell as of 2/2/19                     #
rem * #           Must be ran as admin or system.                                          #
rem * ######################################################################################
rem * 
rem * With every new version of Windows the following registry key needs to be changed "WinVersion"=dword:somenumber
rem * You need to set the value WinVersion in HKEY_LOCAL_MACHINE\SOFTWARE\OpenShell\OpenShell to match the Windows
rem * build that is installed. It corresponds to the AU version.
rem * If this number doesn't match the current Windows version then auto-upgrade behavior will kick in and you
rem * will get the "Open Shell needs to configure itself" popup after you log in.
rem * Below are some decimal values of windows version.  Install the new windows version and get the value of the 
rem * above key and update the reg file manually or use my script!
rem * Windows 1607 - 167786553  Windows 1703 - 167787223  Windows 1709 - 167782746  Windows 1803 - 167789294 etc.
rem *
rem * ---------------------------------------------------------------------------------------------------------------------
SETLOCAL ENABLEDELAYEDEXPANSION
if exist %windir%\System32\StartMenuHelper64.dll (
	rem File exists, 64Bit
goto :Begin
)
if exist %windir%\System32\StartMenuHelper32.dll ( 
        rem File exists, 32bit
goto :Begin
)
echo * No Open Shell found
goto :eof


:Begin
set valCurrentBuild=
set valCalcCurrentBuild=
set valopenWinVersion=

rem * Get Current Windows Build
for /f "tokens=1,2,3" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" ^| find "CurrentBuild"') do set valCurrentBuild=%%k
echo * Windows Build %valCurrentBuild%
set /a valCalcCurrentBuild=16777216*10+%valCurrentBuild%

rem * Check if Open Shell value matches
for /f "tokens=1,2,3" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\OpenShell\OpenShell" ^| find "WinVersion"') do set /a valopenWinVersion=%%k
if Not Defined valopenWinVersion (
echo * No Open Shell WinVersion number found
goto :eof
)
echo * Calculated value for Open Shell %valCalcCurrentBuild%
echo * Registry value for Open Shell %valopenWinVersion%

rem * Fix Open Shell WinVersion registry value
rem * If you want to always update this value and re-register dll file then change NEQ to GTR below
if %valCalcCurrentBuild% NEQ %valopenWinVersion% (
echo * Changing value to HKEY_LOCAL_MACHINE\SOFTWARE\OpenShell\OpenShell\WinVersion = %valCalcCurrentBuild%
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Openshell\OpenShell" /v "WinVersion" /t REG_DWORD /d %valCalcCurrentBuild% /f
if exist %windir%\System32\StartMenuHelper64.dll (
regsvr32 /s %SystemRoot%\System32\StartMenuHelper64.dll
)
if exist %windir%\System32\StartMenuHelper32.dll ( 
regsvr32 /s %SystemRoot%\System32\StartMenuHelper32.dll
)
) else (
echo * Open Shell WinVersion is OK.
)
goto :eof
:eof

 

About The Author

I have worked in the computer repair field since the early '90s. I was a technician and then Coordinator of Computer Repair for Regional Education Service Agency II (RESA 2) for 18 years. I currently work for Wayne County Schools as a Network Engineer/Technology Specialist. I am responsible for the schools' Internet access, Wi-Fi, networks, servers, laptops, desktops, and operating systems and software.

Related posts

Leave a Reply

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

38 − 31 =