Página 1 de 1
como derrubar usuário Win pelo prg
Enviado: 22 Out 2015 20:37
por paiva_dbdc
Boa noite
como posso fazer logoff de um determinado usuario Win ?
Motivo: como trabalho pelo TS e se por acaso um usuario TS ficar travado
pelo proprio sistema acessado em outro terminal faria o Logoff do usuario
TRAVADO.
ai NAo precisaria usar o aplicativo de gerenciamento de terminais e fazer
por la.
APROVEITANDO...
ai tambem poderia derrubar o usaurio em um W7 Emulando o TS ?!....
acredito que seria === correto ?
Paiva
como derrubar usuário Win pelo prg
Enviado: 22 Out 2015 20:59
por alxsts
Olá!
Talvez este artigo ajude:
How to logoff remote desktop sessions via command line tools?
Procure no Google por "kill sessions in windows". Tem muita coisa...
como derrubar usuário Win pelo prg
Enviado: 23 Out 2015 16:27
por Kapiaba
Não tenho certeza se funcionará, mas podeis usar o comando SHUTDOWN do próprio windows para fazer logoff. abs.
como derrubar usuário Win pelo prg
Enviado: 04 Nov 2015 15:06
por Kapiaba
Talvez possa te ajudar:
Código: Selecionar todos
/*
Copyright (C) 1999 Jose Lalin <dezac@corevia.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version, with one exception:
The exception is that if you link the Harbour Runtime Library (HRL)
and/or the Harbour Virtual Machine (HVM) with other files to produce
an executable, this does not by itself cause the resulting executable
to be covered by the GNU General Public License. Your use of that
executable is in no way restricted on account of linking the HRL
and/or HVM code into it.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
their web site at http://www.gnu.org/).
*/
// #Include "FiveWin.Ch"
#Define EWX_LOGOFF 0
#Define EWX_SHUTDOWN 1
#Define EWX_REBOOT 2
#Define EWX_FORCE 4
#Define EWX_POWEROFF 8
CLASS TShutDown
DATA nError PROTECTED
METHOD New() INLINE Self
// Terminates all apps and logs off the current user
METHOD LogOff() INLINE ::nError := ExitWndEx( EWX_LOGOFF, 0 )
// Shuts down the computer
METHOD ShutDown() INLINE ::nError := ExitWndEx( EWX_SHUTDOWN, 0 )
// Rebootes the pc
METHOD Reboot() INLINE ::nError := ExitWndEx( EWX_REBOOT, 0 )
// Forces all processes to terminate. This can cause
// the application lose data if not saved
METHOD Force() INLINE ::nError := ExitWndEx( EWX_FORCE, 0 )
// Shuts down the computer and turns off power
METHOD PowerOff() INLINE ::nError := ExitWndEx( EWX_POWEROFF, 0 )
ENDCLASS
DLL32 FUNCTION ExitWndEx( uFlags AS DWORD, dwRes AS DWORD ) ;
AS BOOL PASCAL FROM "ExitWindowsEx" LIB "User32.dll"
como derrubar usuário Win pelo prg
Enviado: 09 Nov 2015 21:39
por dbsh
Para quebrar o galho este script em bat e rápido e fácil, e funciona com qualquer windows
você pode escolher qual seção você quer derrubar
Código: Selecionar todos
@echo off
qwinsta
set opcao=
set /p "opcao=>Digite ID da secao: "
echo opcao
IF "%opcao%"=="0" goto fim
IF "%opcao%"=="" goto fim
rwinsta %opcao%
:FIM
Já este derruba todas as seções
o primeiro script eu testei já este não deu para testar, iria derrubar todas seções de trabalho do cliente
Código: Selecionar todos
for /f "skip=1 tokens=3" %%a in (qwinsta) do rwinsta %%a
for /f "skip=1 tokens=2" %%a in (qwinsta) do rwinsta %%a
Se você quiser só desconectar as seções sem derrubar troque de rwinsta por tsdiscon
pode chamar do console ou de uma outra seção