Gujuu
(Just in Town)
2016-08-16 01:41 AM
Launch VB script with Kix

Hello all, i'm trying to figure out what to modify in my kix script to execute a VB file.

Here are the contents of the VB script. Filename logonloop.vbs

On Error Resume Next
Dim winhttp
Set winhttp = CreateObject("WinHttp.WinHttpRequest.5.1")
Do While (True)
' Add the correct host name to the next line
winhttp.Open "GET", "http://smoothwall.test.org:814"
winhttp.SetAutoLogonPolicy(0)
winhttp.Send
WScript.Sleep 120000
Loop


Kix Script:
Gosub Smoothwall
?
:Smoothwall
shell "cscript.exe logonloop.vbs"

Please advise.


BradV
(Seasoned Scripter)
2016-08-16 12:53 PM
Re: Launch VB script with Kix

Welcome first. Second, what are you trying to accomplish? I see an infinite loop with a 33 hour delay built in. Is 0 low or high for autologinpolicy? An aside, not sure why you need the gosub line.

ShaneEP
(MM club member)
2016-08-16 03:37 PM
Re: Launch VB script with Kix

I'm not sure that the Shell command is the right choice here, since that will make the kix script wait until the vb script ends, which in this case is never. Try using Run instead. Also might need the full path to the vb script. Both of the below methods work fine for me.

 Code:
Run 'cscript.exe "' + @ScriptDir + '\test.vbs"'

 Code:
Run 'cscript.exe "C:\users\shane\desktop\test.vbs"'


Gujuu
(Just in Town)
2016-08-16 06:34 PM
Re: Launch VB script with Kix

Hello Brad, my goal was to use Kix to map all drives and then execute login loop VB script. The Loginloop script was provided by my firewall manufacturer to forward ActiveDirectory login to my Smoothwall via Kerberos. We have network drive mappings & printer mappings on our KIX script. I was told gosub would be a better way of organizing it.

Also, thank you Shane. That did the trick.


LonkeroAdministrator
(KiX Master Guru)
2016-08-17 02:46 PM
Re: Launch VB script with Kix

You shouldn't run the vbs in your login script.

Windows will kill it at some point and until it does, all your xlinets will have kixtart open on the server. It will be a mess that will only work for some time.

You should instead have kixtart copy these files to local path and execute it under hkcu-run-key.

My we filter provider similar script and until I dis the above mentioned change, it never worked right.