|
Answer» Hello, can someone tell me the syntax I would use in a batch file (logon script) that checks the OS VERSION? I want to use a logon script that only PERFORMS a function on XP machines as opposed to earlier versions. Thanks!If your using VB Script then you can try this:
Code: [Select]strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems Wscript.Echo objOperatingSystem.Caption & " " & _ objOperatingSystem.Version Next If you parse objOperatingSystem.Version you can extract the info you need.
OR with a .bat file
Code: [Select]echo off ver > dummy.txt for /f "tokens=1-4" %%i in (dummy.txt) do (if %%k=="XP" whatever ) del dummy.txt
You will have to make some adjustments depending on your situation.
Hope this helps.
|