Page 1 of 1 1
Topic Options
#179282 - 2007-08-14 05:05 PM Verification of script running or errors
John45 Offline
Fresh Scripter

Registered: 2007-08-10
Posts: 8
Ok in my script which is done via KiXtart I have the following command

run "cscript \\server\netlogon\xxx.vbs"

My script runs and i get all my other mappings. The issue i have is that the screen comes up and flashes so fast i dont know if its registering an error or just procesing smoothly.

Whats my best way to check this ?


Edited by John45 (2007-08-14 05:06 PM)

Top
#179283 - 2007-08-14 05:33 PM Re: Verification of script running or errors [Re: John45]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
This is covered in the FAQ forum.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#179285 - 2007-08-14 05:37 PM Re: Verification of script running or errors [Re: John45]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
You could use redirectoutput or a short sleep at the end of the script or run it in debug mode to see what's happening.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#179320 - 2007-08-15 09:39 AM Re: Verification of script running or errors [Re: John45]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 Originally Posted By: John45
Whats my best way to check this ?


Run from the command prompt.

Top
#179322 - 2007-08-15 09:54 AM Re: Verification of script running or errors [Re: John45]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Why use KiXtart for logon to start a VBScript that maps drives? I would think you would choose for KiXtart or for VBS.
Top
#179330 - 2007-08-15 12:31 PM Re: Verification of script running or errors [Re: Witto]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
You would think - eh?

The environment I inherited recently had 130+ bat files, 130+ kix files (calling additional VBS scripts) and somewhere around 40 VBS scripts. Even worse, some kix scripts called 3 separate VBS scripts, which each mapped one drive. All of this to support the login process! One of the most bizzare things I've seen in the technology world.

Can anyone guess how many .KIx and .VBS scripts are present today? ;\)

As for your issue, a sleep called from your VBS would work, but not from within Kix (the window would open/shut, then kix would wait). Richard had the best idea for troubleshooting - don't run the .VBS script from kix (even temporarily). Alter a copy of your login scrip to run SHELL '%COMSPEC%' - kix will pop open a command prompt and wait for YOU to close it.

Modify your account to run the modified login script, then log in. Run the VBS script manually when the command window opens - check the results, and type EXIT - the kix script will continue. This way, you can closely control the actual process of the login script, during login time.

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

Top
#179332 - 2007-08-15 12:55 PM Re: Verification of script running or errors [Re: Glenn Barnas]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
I'd say go for Glenn's suggestion - the other works fine as well tho.
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#179334 - 2007-08-15 01:07 PM Re: Verification of script running or errors [Re: Björn]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Convert all VBS files to kix functions :P
KORG - VBS WILL be Assimilated! ;\)

Top
#179335 - 2007-08-15 01:12 PM Re: Verification of script running or errors [Re: Arend_]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Acctually, that is what I would recommend. or just do everything with vbs. it's a pita to manage that kind of mix..
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#179337 - 2007-08-15 01:40 PM Re: Verification of script running or errors [Re: Björn]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Generally I recommend not relying on Sleep() or prompting for "press a key" when debugging, as the script can abend before you get that far.

Sometimes you need to run something live where the error is intermittent or unpredictable. In this case I wrap the script in a very simple batch file. The batch file checks the error exit code from KiXtart, and if it is not a specific value then I pause the batch file or mail debug info. If KiXtart exits unexpectedly the exit code is not set so it triggers the event.

I've also done the same thing where the batch script creates a file then calls the KiXtart script. The KiXtart script deletes the file just before it exists. If the batch file sees the script is still present then something must have failed, and again I pause the batch file or mail debugging information.

Top
#179344 - 2007-08-15 03:17 PM Re: Verification of script running or errors [Re: Björn]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4402
Loc: New Jersey
I thoroughly agree.. it's just that sometimes you need to get what you inherited working long enough to find time to really fix it. Conversion of VBS to KIX is not always easy if you are new to either (or both) environments.

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

Top
#179345 - 2007-08-15 03:18 PM Re: Verification of script running or errors [Re: Witto]
John45 Offline
Fresh Scripter

Registered: 2007-08-10
Posts: 8
Im not using the VBS to map drives..all the drive mappings happen in the KiX code..The vbs is a recent add on that Im using to set some registry values and disable some check boxes in IE.
Top
#179346 - 2007-08-15 03:20 PM Re: Verification of script running or errors [Re: Glenn Barnas]
John45 Offline
Fresh Scripter

Registered: 2007-08-10
Posts: 8
Thanks for the advice everyone, ill make some changes today and see what I come up with.

I appreciate all the feedback, im sorry asked something that should be found in the FAQ; ill dig more before i post next time.

Top
#179349 - 2007-08-15 06:16 PM Re: Verification of script running or errors [Re: John45]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
 Originally Posted By: John45
Im not using the VBS to map drives..all the drive mappings happen in the KiX code..The vbs is a recent add on that Im using to set some registry values and disable some check boxes in IE.


Well (IMHO) KiXtart is much easier to do Registry Reads/Writes than VBS is.

No need to be sorry about posting asking for help, we've all been there at one time or another in our lives.

Using both KiX and VBS though is more trouble for you and anyone else that has to work on it. I would choose one or the other myself.

Post your VBS code for Registry mods or just what you want to change in the Registry and I'm sure we can assist you doing it with KiXtart.

Top
#179411 - 2007-08-16 10:33 PM Re: Verification of script running or errors [Re: NTDOC]
John45 Offline
Fresh Scripter

Registered: 2007-08-10
Posts: 8
 Code:
On Error Resume Next

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
    strComputer & "\root\default:StdRegProv")
 
Dim strValue
strValue = ""
'Determine most recent installed version of Java
strKeyPath = "SOFTWARE\Microsoft\Internet Explorer\AdvancedOptions\JAVA_SUN\SELECT"
strValueName = "RegPath"
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
'Wscript.Echo strValue 'something like Software\JavaSoft\Java Plug-in\1.6.0_02

'Set values for most recent version
If strValue <> "" Then
	strKeyPath = strValue
	strValueName = "UseJava2IExplorer"
	dwValue = 0
	oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
	strValueName = "HideSystemTrayIcon"
	dwValue = 1
	oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
End If

'Set values for java versions on the standard desktop image
'Version 1.3.1_15
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.3.1_15"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Version 1.4.2_07
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.4.2_07"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "HideSystemTrayIcon"
dwValue = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Version 1.5.0_01
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.5.0_01"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "HideSystemTrayIcon"
dwValue = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Disable Java Automatic Updates
strKeyPath = "SOFTWARE\JavaSoft\Java Update\Policy"
strValueName = "EnableJavaUpdate"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "EnableAutoUpdateCheck"
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue



Top
#179413 - 2007-08-17 04:11 AM Re: Verification of script running or errors [Re: John45]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Well in general no sense in checking the value, just set it. But we can if you like.

Something like this (untested code)

 Quote:
Dim $JPath, $WV
$JPath = 'HKLM\SOFTWARE\Microsoft\Internet Explorer\AdvancedOptions\JAVA_SUN\SELECT'
$WV = WriteValue($JPath,'UseJava2IExplorer',0,REG_DWORD)
$WV = WriteValue($JPath,'HideSystemTrayIcon',1,REG_DWORD)
$WV = WriteValue('HKLM\SOFTWARE\JavaSoft\Java Plug-in\1.3.1_15','UseJava2IExplorer',0,REG_DWORD)
$WV = WriteValue('HKLM\SOFTWARE\JavaSoft\Java Plug-in\1.4.2_07','UseJava2IExplorer',0,REG_DWORD)
$WV = WriteValue('HKLM\SOFTWARE\JavaSoft\Java Plug-in\1.4.2_07','HideSystemTrayIcon',1,REG_DWORD)
$WV = WriteValue('HKLM\SOFTWARE\JavaSoft\Java Plug-in\1.5.0_01','UseJava2IExplorer',0,REG_DWORD)
$WV = WriteValue('HKLM\SOFTWARE\JavaSoft\Java Plug-in\1.5.0_01','HideSystemTrayIcon',1,REG_DWORD)
$WV = WriteValue('HKLM\SOFTWARE\JavaSoft\Java Update\Policy','EnableJavaUpdate',0,REG_DWORD)
$WV = WriteValue('HKLM\SOFTWARE\JavaSoft\Java Update\Policy','EnableAutoUpdateCheck',0,REG_DWORD)


A user would need to be a local admin to run this though or we could also code it so it could be run from your workstation against all the remote computers if wanted.

Top
#179591 - 2007-08-22 07:26 PM Re: Verification of script running or errors [Re: NTDOC]
John45 Offline
Fresh Scripter

Registered: 2007-08-10
Posts: 8
Thanks for all the help, coding and advice !

We are going through our testing this week so ill post up what i ended up using once i verify it does everything i wanted.

Top
#179592 - 2007-08-22 08:09 PM Re: Verification of script running or errors [Re: John45]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
I'll shoot that as systemaccount. just silly to write stuff with the user account when it's not directly connected to the user (hkcu).
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

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 484 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.069 seconds in which 0.024 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