Page 1 of 2 12>
Topic Options
#36003 - 2003-02-05 11:36 AM disable keyboard in win2k
AmunRa Offline
Fresh Scripter

Registered: 2003-02-05
Posts: 8
Is it possible to disable your keyboard in win2k?
I need a script for that!!! [Wink]

I give a little explaination (if that word exists lol)...
We have some users on a network, and at the startup there is running a script. The script starts a batch file that looks for user who are loggedin serveral times. BUT...the smart asses have find out that when the batch is running the can use CTRL+C to interupt it...
That way they can login again. So that's why i place this question [Roll Eyes] !

Greetz and thx,

AmunRa

PS. Sorry for my bad English, I am from Holland [Wink] !

Top
#36004 - 2003-02-05 11:42 AM Re: disable keyboard in win2k
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
running batch under kix, removes their ability to do that.

and anyway would be better to skip the batch totally.

if someone tries to end kix while it's running, it will logoff the person.
_________________________
!

download KiXnet

Top
#36005 - 2003-02-05 11:54 AM Re: disable keyboard in win2k
AmunRa Offline
Fresh Scripter

Registered: 2003-02-05
Posts: 8
Well.....I have deleted the batch and pasted it into the kix script. That works but they can still use the CTRL+C combination.

[ 05. February 2003, 11:56: Message edited by: AmunRa ]

Top
#36006 - 2003-02-05 11:56 AM Re: disable keyboard in win2k
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if you have "break on" (see manual) in your script, then it's possible.
otherwise it will always logoff.
_________________________
!

download KiXnet

Top
#36007 - 2003-02-06 12:01 AM Re: disable keyboard in win2k
AmunRa Offline
Fresh Scripter

Registered: 2003-02-05
Posts: 8
The Break thing is a problem...it does not work when I tell the script Break off. They can still CTRL+C it [Frown] !

(I don't want to act like a total dork....but I am just a loser and newbie in scripting in Kix)

Top
#36008 - 2003-02-06 12:12 AM Re: disable keyboard in win2k
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there is no need for break off if there is no break on.

may I ask what version of kix you are running on?
and if your script is short, could you post it?
_________________________
!

download KiXnet

Top
#36009 - 2003-02-06 12:54 AM Re: disable keyboard in win2k
AmunRa Offline
Fresh Scripter

Registered: 2003-02-05
Posts: 8
Version 4.12.0.0

Maybe a to old version?

Top
#36010 - 2003-02-05 02:15 PM Re: disable keyboard in win2k
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
can't be as it's the newist release [Wink]

so, there is something else wrong.
_________________________
!

download KiXnet

Top
#36011 - 2003-02-05 02:55 PM Re: disable keyboard in win2k
AmunRa Offline
Fresh Scripter

Registered: 2003-02-05
Posts: 8
Well it's quite a long script, but this is the part what it's all about:

BREAK OFF (-> this is on top of the script)

IF @WKSTA = "PDKCITRIX1" OR @WKSTA = "PDKCITRIX2"
IF @INWIN = 1
; WNT
;SHELL "\\pdkfp\netlogon\logout.bat"
ENDIF
ENDIF


and the logout.bat contains the following:

IF %COMPUTERNAME%==PDKCITRIX1 GOTO LOGOFF
IF %COMPUTERNAME%==PDKCITRIX2 GOTO ENDLOGOFF
GOTO ENDLOGOFF
:LOGOFF
For /F "Tokens=1" %%I in ('\\pdkfp\netlogon\queryuser.bat') Do Set sessions=%%I
IF %sessions%==1 goto ENDLOGOFF
msg %sessionname% U ben al een keer aangemeld en wordt uitgelogt, neem contact op met afdeling ICT
sleep 3
logoff %SESSIONNAME%
:ENDLOGOFF


Hope you can do something with it?

Top
#36012 - 2003-02-05 03:16 PM Re: disable keyboard in win2k
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
If you truly need to block user input AutoIt is your friend. Do a search on the board for "block input" and you should come up with a couple of hits and examples of use.
Top
#36013 - 2003-02-05 03:18 PM Re: disable keyboard in win2k
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
In fact, here is an example...

code:
; Created with the AutoItX ActiveX component.
; Get it at: http://www.hiddensoft.com/AutoIt/

$objAutoIt = CreateObject("AutoItX.Control")
If @ERROR
"AutoIt Control not instantiated..." ?
Copy @SCRIPTDIR+"\AutoItX.dll" %WINDIR%
If @INWIN = "1"
Shell "%COMSPEC% /c Regsvr32 /s %WINDIR%\AutoItX.dll"
Else
Shell "%COMSPEC% /c %WINDIR%\System\Regsvr32 /s %WINDIR%\AutoItX.dll"
EndIf
$objAutoIt = CreateObject("AutoItX.Control")
If @ERROR "Unable to instantiate control: fatal error" Exit 1 EndIf
endif

If $objAutoIt
$objAutoIt.BlockInput("On")
; Do stuff here...
$objAutoIt.BlockInput("Off")
EndIf


Top
#36014 - 2003-02-05 03:22 PM Re: disable keyboard in win2k
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I would also use BREAK OFF in combination with WKIX32 instead of KIX32.
_________________________
There are two types of vessels, submarines and targets.

Top
#36015 - 2003-02-05 03:35 PM Re: disable keyboard in win2k
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, you control the logoff from the batch.
still, my suggestion would be to include the logic in the script.

you can write this differently though thus enabling it.

do the batch as:
code:
IF %COMPUTERNAME%==PDKCITRIX1 GOTO LOGOFF
IF %COMPUTERNAME%==PDKCITRIX2 GOTO ENDLOGOFF
GOTO ENDLOGOFF
:LOGOFF
For /F "Tokens=1" %%I in ('\\pdkfp\netlogon\queryuser.bat') Do Set sessions=%%I
IF %sessions%==1 goto ENDLOGOFF
msg %sessionname% U ben al een keer aangemeld en wordt uitgelogt, neem contact op met afdeling ICT
sleep 3

:ENDLOGOFF
exit 1

and then the kix:
code:
IF @WKSTA = "PDKCITRIX1" OR @WKSTA = "PDKCITRIX2"
IF @INWIN = 1
SHELL "\\pdkfp\netlogon\logout.bat"
if @error=0
run "logoff %%SESSIONNAME%%" exit 0
endif
ENDIF
ENDIF

you don't need the break off.

[ 05. February 2003, 15:38: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#36016 - 2003-02-05 03:38 PM Re: disable keyboard in win2k
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, forgot to post this and now there is like zillion posts.

the post of mine makes sure that person is logged off even though they break the batch execution.

only way to continue to logon is controlled running of batch until the "exit 1" is met.

like said, there is no reason to use break off as it's on by default.
_________________________
!

download KiXnet

Top
#36017 - 2003-02-05 03:38 PM Re: disable keyboard in win2k
AmunRa Offline
Fresh Scripter

Registered: 2003-02-05
Posts: 8
Ow ok guy's thx for the reply's. I'll look if i get it working...and...urhm...sealeopard...WKIX32?

[ 05. February 2003, 15:39: Message edited by: AmunRa ]

Top
#36018 - 2003-02-05 03:38 PM Re: disable keyboard in win2k
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
And use the KiXtart LOGOFF() function, too. Finally, take advantage of logoff scripts under Windows 2000/XP, which can be defined in the local computer policy.

WKIX32.EXE = console-less KIX32.EXE

[ 05. February 2003, 15:39: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#36019 - 2003-02-05 03:40 PM Re: disable keyboard in win2k
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
logoff scripts?
I think this is matter of logon-stuff and there is no logoff scripts ran in that situation.

mm...
neither in this particular situation there is no use using wkix32.exe
it might even make it harder...
anyway, suggestion to use wkix32 instead is good suggestion and that should be pointed to everyone.

[ 05. February 2003, 15:44: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#36020 - 2003-02-05 03:43 PM Re: disable keyboard in win2k
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
If i understand it correctly, he want to prevent somebody from logging in when certain conditions are met. Thus, during the login, he issues a logoff which then triggers the logoff.bat. Then it doesn't matter whether the user tries to close the batch file as he's being logged off anyway [Wink]
_________________________
There are two types of vessels, submarines and targets.

Top
#36021 - 2003-02-05 03:46 PM Re: disable keyboard in win2k
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
again, the logoff.bat is executed only if the batch is not interrupted.

my code above transfers the control to kix.
if condition met or interrupted -> logoff.

I could have made it use kix's internals but, just copy&pasted. that's my bad.
_________________________
!

download KiXnet

Top
#36022 - 2003-02-05 04:07 PM Re: disable keyboard in win2k
AmunRa Offline
Fresh Scripter

Registered: 2003-02-05
Posts: 8
Thx m8 for all the work...and i don't want to be a giant stone on your leg...but the code does not seems to work.

It runs like a fast ferrari, but it does not log the user off [Frown] sorry.

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 194 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.092 seconds in which 0.056 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