icecom4
asked on
Batch to check server OS (ignores desktop OS kernels)
I am trying to make a batch that checks the version of the OS and if found, moves on to a part of the script. I have two problems. This script below works for windows xp, vista, 7...etc but not windows server OS.
Example of what I want...
if I use something more specific like the below to find server 2008, the problem is that this is also the kernel for windows 7 and I cannot have that.
Can sombody help me create a OS check that ONLY looks for windows servers 2003, 2008, and 2012? And ignores desktop OS kernels like windows 7?
Thanks in advance
Example of what I want...
ver | find "2003" > nul
:: error 0 means found
if %ERRORLEVEL% == 0 goto Nextgen
) ELSE (
ver | find "2008" > nul
:: error 0 means found
if %ERRORLEVEL% == 0 goto Nextgen
) ELSE (
ver | find "2012" > nul
:: error 0 means found
if %ERRORLEVEL% == 0 goto Nextgen
if I use something more specific like the below to find server 2008, the problem is that this is also the kernel for windows 7 and I cannot have that.
VER | FINDSTR /IL "6.1." > NUL
Can sombody help me create a OS check that ONLY looks for windows servers 2003, 2008, and 2012? And ignores desktop OS kernels like windows 7?
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER