#210856 - 2015-10-26 10:01 AM
Compare Operating System Version
|
globi84
Just in Town
Registered: 2015-10-26
Posts: 3
Loc: Switzerland
|
Hi Kixtart Community
in our company do we use for a logon script kixtart.
I want make for the Windows 8 and later Users some changes different then the Windows 7 Users.
My Idea was like this.
$osversion = @DOS
if $osversion >= 6.2
? "Do something for Windows 8 and later."
else
? "Do Something for Windows 7 and earlier."
endif
this compare doesn't work every time is this compare true.
When I set the variable "$osversion" for example
I think the problem is something wrong with the data type that I get from the "@DOS" command.
Can you give me a tip to fix this problem.
regards
christian
Edited by globi84 (2015-10-26 10:01 AM)
|
Top
|
|
|
|
#210857 - 2015-10-26 11:27 AM
Re: Compare Operating System Version
[Re: globi84]
|
BradV
Seasoned Scripter
Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
|
Kixtart is not strongly typed. Try adding in some error checking:
if @DOS >= 6.2
? @SERROR
? "Do Windows 8 stuff"
else
? @SERROR
? "Do Windows 7 stuff"
endif See what that gives you.
|
Top
|
|
|
|
#210858 - 2015-10-26 11:52 AM
Re: Compare Operating System Version
[Re: globi84]
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
|
Try using this:
$osversion = ReadValue("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion","CurrentVersion")
|
Top
|
|
|
|
#210861 - 2015-10-26 12:04 PM
Re: Compare Operating System Version
[Re: Glenn Barnas]
|
globi84
Just in Town
Registered: 2015-10-26
Posts: 3
Loc: Switzerland
|
Thanks glenn
with the function val() works now.
thank you for your fast response.
regards
christian
|
Top
|
|
|
|
#210862 - 2015-10-26 02:55 PM
Re: Compare Operating System Version
[Re: globi84]
|
globi84
Just in Town
Registered: 2015-10-26
Posts: 3
Loc: Switzerland
|
Sorry with val it doesn't work too.
with the "1.0 *" I get just the first digit. i think this is a problem about the "," char. in Switzerland we have comma separated not with a point.
@arend
With your solution i have the same problem with "@DOS"
now I make the check with @PRODUCTTYPE
if @PRODUCTTYPE == "Windows 7 Enterprise Edition"
;? "Do Something for Windows 7"
else
;? "Do something for other Windows"
endif
in this way I don' t have the flexibility with a numeric variable. but on this way I can make different between the Windows 7 and the others.
thanks for your help
regards
christian
|
Top
|
|
|
|
#210863 - 2015-10-26 03:15 PM
Re: Compare Operating System Version
[Re: globi84]
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4545
Loc: USA
|
Please post your code for the 1.0* code, there is probably something amiss.
As for the other code, this will likely cover your bases a bit better.
Select
Case instr(@producttype,"Windows 7")
;do stuff
Case instr(@producttype,"Windows 8")
;do stuff
Case 1
? "OS not covered"
Endselect
|
Top
|
|
|
|
#210867 - 2015-10-27 09:26 AM
Re: Compare Operating System Version
[Re: Allen]
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
|
Personally I use code similar to Allen's:
Select
Case Left(@ProductType,9) = "Windows 7"
;do stuff
Case Left(@ProductType,9) = "Windows 8"
;do stuff
Case Left(@ProductType,10) = "Windows 10"
;do stuff
Case 1
? "OS not covered"
Endselect
|
Top
|
|
|
|
#213671 - 2019-04-16 08:48 PM
Re: Compare Operating System Version
[Re: Arend_]
|
AlexTheGreat
Just in Town
Registered: 2017-12-13
Posts: 1
Loc: CA
|
The following table summarizes the most recent operating system version numbers.
Operating system Version number Windows 10= 10.0* Windows Server 2019= 10.0* Windows Server 2016= 10.0* Windows 8.1= 6.3* Windows Server 2012 R2= 6.3* Windows 8= 6.2 Windows Server 2012= 6.2 Windows 7= 6.1 Windows Server 2008 R2= 6.1 Windows Server 2008= 6.0 Windows Vista= 6.0 Windows Server 2003 R2= 5.2 Windows Server 2003= 5.2 Windows XP 64-Bit Ed= 5.2 Windows XP= 5.1 Windows 2000= 5.0
Source: https://docs.microsoft.com/en-us/windows/desktop/SysInfo/operating-system-version
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 248 anonymous users online.
|
|
|