Hello,

For your information, here's how we run our KIX scripts with administrator rights using PSEXEC in our network. We're using a batch script to launch a KiX script launching another KiX script with admin rights.

The admin user can be either the local admin (if it's the same on all your PCs) or a domain admin user, which is however less secure.

It is important to always tokenize the launcher script to prevent your users from reading the admin password from it.

PSEXEC.EXE has to be present in the same folder as your KiX script.

Note the workaround to pass the username to the main script avoid having @USERID returning the admin username.

In your main script (mainscript.kx), you'll need to use $UserID instead of @USERID if you need to get the name of the user which is running your script instead of the psexec admin user.

Comments are welcome.

Best regards,
Olivier



* LAUNCHER.BAT (logon script for all users, stored in NETLOGON$)
 Code:
@echo off
WKIX32.EXE kixlauncher.kx



* KIXLAUNCHER.KX
 Code:
;*************************************************************************
;  Script Name:   KixLauncher
;  Author:        Olivier
;  Date:          6/01/2011
;  Description:   Launches KIX with admin rights.
;                 ** WARNING **
;                 This script should NEVER be stored in clear text on NETLOGON
;			 
;*************************************************************************
 
;Script Options
Break OFF

Shell @LSERVER + "\netlogon\psexec -accepteula -e -w %logonserver%\netlogon -u youradminuser -p yourpassword wkix32.exe //nologo %logonserver%\netlogon\mainscript $UserID=@USERID"

If @ERROR
	;	? " ! Launcher returned error code " + @ERROR
	Exit(@ERROR) 
EndIf