Sealeopard
(KiX Master)
2003-12-08 07:27 PM
How-TO: Run KiXtart scripts via LPO/GPO

By default, Windows LPO/GPOs do not run KiXtart scripts as e.g. startup/shutdown/logon/logoff scripts. Scripts are limited to Windows Scripting Host registered script extensions such as .WSH, .JS or Perl/PHP extensions if the appropriate AxtiveX scripting engine is installed. Kixtart does not offer this ActiveX integration into WSH. A standard workaround is to assign a batch file to the script to be launched via LPO/GPO.

However, there is a way to directly launch KiXtart scripts via LPO/GPO without the use of a batch file.

Two steps need ot be performed on the computer that is going to use the KiXtart script. These tow steps will result in the association of a KiXtart script extension with the KiXtart executable to be used to run the script. There are two options to achieve this, either via command-line or via registry modification.

The following two command-line commands will create this association and specify that files with the . KXS (KiXtart Script) are using the WKIX32.EXE (should be located in a directory listed in %PATH%, e.g. %WINDIR%. Otherwise, provide the full path to WKIX32.EXE) and that all command-line switches are being passed into WKIX32.EXE for further interpretation.
Code:

ASSOC .KXS=KiXtart.Script
FTYPE KiXtart.Script=wkix32.exe %1 %*


The same results are achieved by importing the following .REG file which also creates this association.
Code:
REGEDIT4


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.kxs]
@="KiXtart.Script"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\KiXtart.Script]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\KiXtart.Script\Shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\KiXtart.Script\Shell\Open\Command]
@="wkix32.exe %1 %*"





One can now copy KiXart scripts into the appropriate group policy subfolders and select these KiXtart scripts in the group policy MMCs.

A drawback of this method is that users can now execute .KXS scripts by just double-clicking on it.


Les
(KiX Master)
2003-12-08 07:42 PM
Re: How-TO: Run kiXtart scripts via LPO/GPO

Jens,
Nice bit of research. I see the reg merge is to HKLM so assume admin rights required. Does that also hold true for the first method? I don't want to test as I abhor associating the extension.


Sealeopard
(KiX Master)
2003-12-08 07:57 PM
Re: How-TO: Run kiXtart scripts via LPO/GPO

Haven't tried it with user-privs. However, the association should be done computer-wide so that all users will be able to run the scripts. I also don't know wheter one could craft a GPO that forces this association as I don't have AD.

NTDOCAdministrator
(KiX Master)
2003-12-09 01:22 AM
Re: How-TO: Run kiXtart scripts via LPO/GPO

Quote:

A drawback of this method is that users can now execute .KXS scripts by just double-clicking on it




This is ONE of the main reasons (in my opinion) for using KiXtart. There is no association. Which is how VBS got such a bad rap in the first place when Melissa came along.

I'm content to just use the users LOGON script inside his/her property settings of AD. I don't need a batch file there either.

Finance\WKIX32.EXE Finance\LOGON.KIX

Works just fine for me. But I'm sure there are others out there that will very much appreciate your information Jens and use it.


Sealeopard
(KiX Master)
2003-12-09 04:01 AM
Re: How-TO: Run kiXtart scripts via LPO/GPO

I totally agree with this assessment. I don't want the .KXS association either. However, I was curious how to trick the GPO into using KiXtart scripts. I'd also go with the logon script property in AD (once we actually go over to AD).

LonkeroAdministrator
(KiX Master Guru)
2003-12-09 06:17 AM
Re: How-TO: Run kiXtart scripts via LPO/GPO

do not understand what is the trick here though.
this is normal filetype registeration.
obviously - on windows - if you want to execute a file that is not executable, you need to have the information specified by which executable it is to be ran.
so, no magic here.


NTDOCAdministrator
(KiX Master)
2003-12-09 09:50 AM
Re: How-TO: Run kiXtart scripts via LPO/GPO

I agree Lonk. No magic and I know how to do this as well. However, not everyone does and Jens was simply posting how to do it so that it makes it very easy for someone to make this change if they so desire and don't already know how.

That is one of the main purposes of this board I think. Sharing thoughts and ideas. Not just serving up code when and only when asked.


Sealeopard
(KiX Master)
2003-12-09 03:52 PM
Re: How-TO: Run KiXtart scripts via LPO/GPO

Yeah, that's why the subject line says HOW-TO:

A lot of people (incl. sys admins) no longer know how to use the command line, thus they try to assign a KiXtart script via the LPO/GPO MMC and then wonder why it doesn't work. They might then check the documentation and find out that by default only executables and WSH-based script extensions are supported.


Sealeopard
(KiX Master)
2003-12-09 06:14 PM
Re: How-TO: Run KiXtart scripts via LPO/GPO

Little add-on to the registry hack to make the script extension also have a desciption:
Code:
REGEDIT4


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.kxs]
@="KiXtart.Script"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\KiXtart.Script]
@="KiXtart Script"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\KiXtart.Script\Shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\KiXtart.Script\Shell\Open\Command]
@="wkix32.exe %1 %*"



The registry settings could either be packaged into a .MSI file for distribution to all computers via GPO or alternatively, a custom .ADM file cound be created in order to distribute the registry settings on a per-computer basis.

And here's a little freeware program that can make .MSI files: http://www.labyrinth.net.au/~dbareis/makemsi.htm


Mit
(Fresh Scripter)
2004-10-20 06:36 PM
Re: How-TO: Run kiXtart scripts via LPO/GPO

Quote:

Quote:

A drawback of this method is that users can now execute .KXS scripts by just double-clicking on it




Finance\WKIX32.EXE Finance\LOGON.KIX

Works just fine for me. But I'm sure there are others out there that will very much appreciate your information Jens and use it.





The problem with this system is that it relies on a modification for all users. Until now we have had a single logon script that everyone ran and did things based on group membership - I'm guessing a lot of people do the same thing.

What I would like to do now that I'm looking at AD is to have a little logon script for each GP object.

I've made a GP OU called 'staff' into which I've created more OUs, one for each company department. The 'staff' OU is the one that contains most of the security settings and so forth, plus a generic logon script that everyone will run which maps their home drive, etc.

However, for each dept I want to run an additional script. I basically need to be able to put a line into the LOGON section of each OU's GP object that will run a KiX script. I can't see how to do this though... and I don't want to have to register the KiX extension.

Anyone....?


Les
(KiX Master)
2004-10-20 06:48 PM
Re: How-TO: Run kiXtart scripts via LPO/GPO

You don't need to register the extension if you are willing to use a BATch file to kick it off.

Les
(KiX Master)
2004-10-20 06:51 PM
Re: How-TO: Run kiXtart scripts via LPO/GPO

Also, please start your own topic rather than hijaak this one.

Mit
(Fresh Scripter)
2004-10-26 12:34 PM
Re: How-TO: Run kiXtart scripts via LPO/GPO

Hijack? Excuse me but I replied to an existing topic that related to a query that I have. I really don't see how that can be seen as a hijack..... Bizarre.

As for the batch file, I don't want to be firing off multiple batch files just in order to start a KiX script. I'd much rather be able to just plonk the KiX script name directly into the GP object.