Page 1 of 1 1
Topic Options
#174380 - 2007-03-01 10:02 PM Check Windows Operating System Version
endodave Offline
Starting to like KiXtart

Registered: 2005-08-17
Posts: 101
I'm trying to push the Time Zone Update via a Group Policy, but I only want to run it against those machines that are Windows XP. Is there a way to check for specific OS version in kixtart? I know there is a generic Win NT check, but I need something more granular so the update doesn't get pushed to W2K clients. Also, is there a way to make it so that once the update is applied, it is not applied again after subsequent reboots? In other words, the script first checks to see if it has been applied? I guess one way to do it would be to copy the update file to the local hard drive and then run it from that. Then kixtart could check to see if the file exists on the drive. If it does, exit. Would that work? Is there a better way? Can someone help with the scripting for that? I am not an expert so I sure appreciate any assistance you can provide. Thanks.

Edited by endodave (2007-03-01 10:05 PM)

Top
#174381 - 2007-03-01 11:00 PM Re: Check Windows Operating System Version [Re: endodave]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
Use the @DOS macro for OS version info - XP is "5.1"

You can use ReadValue('hklm\software\mycompany', 'DST') to check if it's installed, and - after a successful install, use
WriteValue('hklm\software\mycompany', 'DST', 1, 'Reg_SZ') to write the flag. Leaving files on machines is a messy way of doing things.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#174382 - 2007-03-01 11:10 PM Re: Check Windows Operating System Version [Re: Glenn Barnas]
endodave Offline
Starting to like KiXtart

Registered: 2005-08-17
Posts: 101
Cool! i have since found that there is a TZI binary key in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Pacific Standard Time that holds the time information and whether or not the update has been applied. is there a way i can read that, compare it to a string and if there is a match, skip. if not, launch the update executable? i'm a little confused how i use readvalue to assign to a variable and then compare that to a string. i'm not sure how kixtart is going to read the value.
Top
#174383 - 2007-03-01 11:32 PM Re: Check Windows Operating System Version [Re: endodave]
endodave Offline
Starting to like KiXtart

Registered: 2005-08-17
Posts: 101
here's what i have so far. unfortunately, the script is calling the executable at start up every time, so something isn't working:

$TZCUR = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Pacific Standard Time", "TZI")

$rc = Open (1, "\\server\kixtart_log\TZ_RegKey.csv", 5)
$rc = writeline (1, @TIME + "," + @DATE + "," + @WKSTA + "," + @USERID + "," + @fullname + "," + $TZCUR + @CRLF)
$rc = Close (1)

$TZNEW = "e001000000000000c4ffffff00000b0000000100020000000000000000000300000002000200000000000000"

if @DOS=5.1
goto install
endif

:install

if $TZCUR <> TZNEW
shell "\\server\netlogon\XPTZupd.exe"
ENDIF

exit

exit


Edited by endodave (2007-03-01 11:41 PM)

Top
#174384 - 2007-03-01 11:48 PM Re: Check Windows Operating System Version [Re: endodave]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
 Code:
If NOT @LOGONMODE
	Break On
Else
	Break Off
EndIf
Dim $RC
$RC = SetOption("Explicit", "On")
$RC = SetOption("NoMacrosInStrings", "On")
$RC = SetOption("NoVarsInStrings", "On")
$RC = SetOption("WrapAtEOL", "On")

Dim $Entry, $Value
$Value = "YouKnowWhatValueItShouldBe"
; Is this the value?
; $Value = "e001000000000000c4ffffff00000b0000000100020000000000000000000300000002000200000000000000"
$Entry = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Pacific Standard Time","TZI")
If NOT $Value = $Entry AND @DOS = "5.1"
	;Do stuff, install update
EndIf

Top
#174385 - 2007-03-01 11:51 PM Re: Check Windows Operating System Version [Re: endodave]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
If in your script, the version is not 5.1, you just go to the EndIf and continue at the flag :Install
Also the vartype of @DOS and 5.1 are different
if I show 5.1 on screen, I see 5,1
better is
If @DOS = "5.1"


Edited by Witto (2007-03-02 12:01 AM)

Top
#174387 - 2007-03-02 12:06 AM Re: Check Windows Operating System Version [Re: Witto]
endodave Offline
Starting to like KiXtart

Registered: 2005-08-17
Posts: 101
well, i think we're getting close. the update is not installing at all now. so, it must think the value = entry.

nevermind - my goof. i'll get back to you....


Edited by endodave (2007-03-02 12:07 AM)

Top
#174388 - 2007-03-02 12:16 AM Re: Check Windows Operating System Version [Re: endodave]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Did you try my script?
If yes, do you have XP?
If yes, is the patch allready installed on your system?
If yes, it will not install.
[Edit]
Is it about KB931836?
Maybe you can uninstall the patch to test?
[/Edit]


Edited by Witto (2007-03-02 12:23 AM)

Top
#174389 - 2007-03-02 12:26 AM Re: Check Windows Operating System Version [Re: Witto]
endodave Offline
Starting to like KiXtart

Registered: 2005-08-17
Posts: 101
it was my goof. had the wrong server name for install. you are a genius! now i am going to try to write one for the outlook update to run after this one. thanks again! i'll write back if i need help.
Top
#174391 - 2007-03-02 12:32 AM Re: Check Windows Operating System Version [Re: endodave]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Good luck!!!
Top
#174392 - 2007-03-02 01:35 AM Re: Check Windows Operating System Version [Re: Witto]
endodave Offline
Starting to like KiXtart

Registered: 2005-08-17
Posts: 101
pretty simple. since the outlook update requires the windows update, i just changed the line to If $Value = $Entry AND @DOS = "5.1" for that portion and viola! thanks again.
Top
#174564 - 2007-03-07 05:29 PM Re: Check Windows Operating System Version [Re: Witto]
endodave Offline
Starting to like KiXtart

Registered: 2005-08-17
Posts: 101
oops, need to know now how to tell if the OS is W2K SP4. from your previous post, @DOS = "5.1" is for XP SP2. Looking forward to your response. thanks!
Top
#174566 - 2007-03-07 06:09 PM Re: Check Windows Operating System Version [Re: endodave]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
$SvcPack = ReadValue('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion', 'CSDVersion')
should work for you, in combination with @DOS.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.076 seconds in which 0.035 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org