Hi, @TIMECOP79
Thank you for posting in Microsoft Q&A forum.
Based on the provided script, the issue seems to be with the findstr command. The search string is currently set to "Windows 10 Enterprise" and it will match any OS containing those words, including "Windows 10 Enterprise" and "Windows 10 Enterprise N". The same is true for the search string "Windows 10 Professional".
To fix the issue, you can modify the search strings to match the exact OS version by adding a space at the end of the search strings. Here's the updated script:
@echo off
REM Check the OS version
wmic os get Caption | findstr /i "Windows 10 Enterprise " > nul
if %errorlevel% equ 0 (
set "install_folder=\\server\share\EnterpriseAppFolder"
) else (
wmic os get Caption | findstr /i "Windows 10 Professional " > nul
if %errorlevel% equ 0 (
set "install_folder=\\server\share\ProfessionalAppFolder"
) else (
echo Unsupported OS version.
exit /b 1
)
)
REM Install the application
echo Installing application from %install_folder%...
msiexec /i "%install_folder%\application.msi" /qn
REM Add additional installation steps if needed
exit /b 0
With this modification, findstr will only match OS versions that contain the exact search string, which should solve the issue you're facing.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Add comment".