Page 1 of 1 1
Topic Options
#205051 - 2012-04-30 06:01 PM Windows 7 issue?? Unable to Call another script?
andrewwarduk Offline
Just in Town

Registered: 2005-11-04
Posts: 2
Loc: uk
I am trying to get Kix to call another script for Windows 7 machines only. It seems that Windows 7 is ignoring the Call, Shell and run commands? on both x64 and x32. I have disabled UAC so its not causing the issue.

Is anyone else having the same problem, I was wondering if this is similar to the Ifingroup bug? BTW I have also tried Kix 4.61 to no avail????

The write value is working and that is being applied to everything other than windows 7
 Code:
; The following registry settings need to be applied to all PC's on the network

If @PRODUCTTYPE = "Windows 2000 Server" GoTo "notsupported"
Else If @PRODUCTTYPE = "Windows 95" GoTo "notsupported"
Else If @PRODUCTTYPE = "Windows Server 2003" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows Server 2003 Domain Controller" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows Server 2003 R2" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows Server 2003 R2 Domain Controller" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows Vista" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows Server 2003 R2 Domain Controller" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows 98" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows Me" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows NT Workstation" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows NT Server" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows NT Domain Controller" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows 2000 Professional" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows 2000 Domain Controller" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows XP Home Edition" GoTo "runscript"
Else If @PRODUCTTYPE = "Windows XP Professional" GoTo "runscript"

;For some reason this is failing to run on Win7 x32 and x64 I have also tried running as shell and run? key.bat resides in netlogon.
CALL @LDRIVE + "\Key.bat"
EndIf

:runscript
WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\AssetCTRL", "Test", "1001", "REG_DWORD")
Endif

:notsupported
EndIf


Key.bat contains

 Code:
REG ADD HKLM\software\AssetCTRL /v Test /t REG_DWORD /d 1001 /F
pause



Edited by Mart (2012-05-01 10:35 AM)
Edit Reason: Please use code tags when posting code.

Top
#205052 - 2012-04-30 07:06 PM Re: Windows 7 issue?? Unable to Call another script? [Re: andrewwarduk]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
You are missing Endifs for most of your ifs.

Also try changing @ldrive to @scriptdir

Top
#205053 - 2012-04-30 07:09 PM Re: Windows 7 issue?? Unable to Call another script? [Re: andrewwarduk]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
If probably has more to do with all your mismatched If/Else/EndIf statements.

You have 17 IF statements, and only 3 EndIf statements.

This should accomplish the same thing...without using the dreaded GoTos.
 Code:
; The following registry settings need to be applied to all PC's on the network

If InStr(@PRODUCTTYPE,"Server 2003") OR
   InStr(@PRODUCTTYPE,"Vista") OR
   InStr(@PRODUCTTYPE,"98") OR
   InStr(@PRODUCTTYPE,"Me") OR
   InStr(@PRODUCTTYPE,"NT") OR
   InStr(@PRODUCTTYPE,"2000 Professional") OR
   InStr(@PRODUCTTYPE,"2000 Domain") OR
   InStr(@PRODUCTTYPE,"XP")
      $nul = WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\AssetCTRL", "Test", "1001", "REG_DWORD")
Else
   If @PRODUCTTYPE <> "Windows 2000 Server" AND @PRODUCTTYPE <> "Windows 95"
      CALL @LDRIVE + "\Key.bat"
   Endif
Endif

Top
#205054 - 2012-04-30 07:12 PM Re: Windows 7 issue?? Unable to Call another script? [Re: ShaneEP]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4562
Loc: USA
The other problem you are going to run into is supporting all these OSs. Win9x is no longer supported in the 4.6x versions, and if you want to support Windows 7 you will likely need version 4.61 or 4.62.
Top
#205055 - 2012-04-30 08:41 PM Re: Windows 7 issue?? Unable to Call another script? [Re: Allen]
andrewwarduk Offline
Just in Town

Registered: 2005-11-04
Posts: 2
Loc: uk
So i take it i need an EndIf after each if statement? sorry im a noobe to Kix
Top
#205056 - 2012-04-30 09:02 PM Re: Windows 7 issue?? Unable to Call another script? [Re: andrewwarduk]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Welcome to KORG!

You might be better served by a Select / Case / EndSelect construct, since that's what you're trying to accomplish with the "Else If" in your code, which isn't supported...

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

Top
#205057 - 2012-04-30 09:12 PM Re: Windows 7 issue?? Unable to Call another script? [Re: andrewwarduk]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
 Originally Posted By: andrewwarduk
So i take it i need an EndIf after each if statement? sorry im a noobe to Kix


Yes. In some instances you may be able to get it to work without, but it is only because Kix is so forgiving.

Top
#205059 - 2012-04-30 11:05 PM Re: Windows 7 issue?? Unable to Call another script? [Re: ShaneEP]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
goto, ouch.

anyways, CALL is for calling kixtart script.
it's not for running bat files which have a totally separate interpreter called cmd.exe

you might wanna see the manual for SHELL command. and to run a program, you need to add the program name (cmd.exe in this case, or %comspec%) to the line. bat is not a program/application and that's why it can't be ran on it's own.

or just remove the bat totally and use kixtart directly instead.
_________________________
!

download KiXnet

Top
#205060 - 2012-05-01 12:09 AM Re: Windows 7 issue?? Unable to Call another script? [Re: Lonkero]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Oh yeah, didnt even notice the CALL there...was too distracted by the ugliness of GoTo's.
Top
#205065 - 2012-05-01 12:03 PM Re: Windows 7 issue?? Unable to Call another script? [Re: ShaneEP]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
Do you really have all those operating systems in your network? If so, I would strongly suggest some standardization. My assumption is that you saw that list in the manual and your just trying to be thorough. You only need to test against the versions that are in your network. Post the contents of your batch file. Someone here should be able to help you translate it into kix script.
Top
#205071 - 2012-05-01 01:49 PM Re: Windows 7 issue?? Unable to Call another script? [Re: BradV]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
his bat actually only contains the writevalue() equivalent he already has in his script.
_________________________
!

download KiXnet

Top
#205073 - 2012-05-01 02:20 PM Re: Windows 7 issue?? Unable to Call another script? [Re: Lonkero]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
Sorry, I should have looked back to the original post. \:\)
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 793 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.065 seconds in which 0.027 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