+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
Windows Server 2008 R2 Thread, Forceably Logoff User in Technical; Originally Posted by round2it we have a startup script that creates a hidden file called logincookie.dat this has date and ...
  1. #16
    bart21's Avatar
    Join Date
    Aug 2009
    Location
    peterborough
    Posts
    404
    Thank Post
    77
    Thanked 54 Times in 52 Posts
    Rep Power
    20
    Quote Originally Posted by round2it View Post
    we have a startup script that creates a hidden file called logincookie.dat this has date and time machine name

    on log off it deletes the file

    if the file exists the system displays a message and says you are logged on to machine name then logs the user off
    are u able to share that script?

    nick

  2. #17
    levell3r's Avatar
    Join Date
    Jan 2011
    Location
    west mids
    Posts
    32
    Thank Post
    4
    Thanked 5 Times in 5 Posts
    Rep Power
    8
    Quote Originally Posted by bart21 View Post
    are u able to share that script?

    nick


    sorry for the oldish bump, just that I was doing this exact thing today..
    but i found a hole in the plan... (which is why i ended up here )


    (please excuse my cruddy cmd skills)


    @logon
    Code:
    rem  check for the logon file to exist
    IF EXIST \\curricsvr2\logs$\logonchecker\%username%.log \\curricsvr2\netlogon\scripts\vbmessage.cmd
    
    rem create a log file of usage by username
    echo %username% >> \\curricsvr2\logs$\logonchecker\%username%.log
    vbmessage.cmd

    Code:
    @echo MSGBOX "You are already logged on. Please log off that machine before starting a new session." > %temp%
    
    \TEMPmessage.vbs
    @call %temp%\TEMPmessage.vbs
     @Del %temp%\TEMPmessage.vbs /f /q
    
    sleep 3
    logoff.exe

    @logoff
    Code:
    rem  file check clear
    del \\curricsvr2\logs$\logonchecker\%username%.log


    which is the theory....
    except...
    it only works once!
    because once you try and logon again - you get logged off. and then it calls the logoff script and clears your logon flag. So your free to login.

  3. #18

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,694
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by levell3r View Post
    sorry for the oldish bump, just that I was doing this exact thing today..
    but i found a hole in the plan... (which is why i ended up here )


    (please excuse my cruddy cmd skills)
    Put a check in the delete line, and only delete it if it's the same computer name as the one they're logged onto. (As the logfile would have the computer name in)

    That way it won't delete the file unless it's the right computer that is logged off.

    Steve

  4. #19
    levell3r's Avatar
    Join Date
    Jan 2011
    Location
    west mids
    Posts
    32
    Thank Post
    4
    Thanked 5 Times in 5 Posts
    Rep Power
    8
    thanks for the reply, though i'm not entirely sure how that works.

  5. #20

    Join Date
    Mar 2012
    Location
    US
    Posts
    56
    Thank Post
    5
    Thanked 3 Times in 3 Posts
    Rep Power
    5
    All of these scripts, and extra software isn't needed... Just KISS keep it simple..... pull up command prompt [net session] you can view all current sessions via username there. If you know the location of his connection ip/mac/host name just boot him via dhcp.

    Disconnect sessions from a given machine
    NET SESSION \\ComputerName /DELETE
    Last edited by rslulz; 19th November 2012 at 03:02 PM.

  6. #21

    Join Date
    Mar 2012
    Location
    US
    Posts
    56
    Thank Post
    5
    Thanked 3 Times in 3 Posts
    Rep Power
    5
    Quote Originally Posted by Gongalong View Post
    Somewhere it is set so they can only be logged on once (Ranger possibly?).



    All we have over and above Windows Server is Ranger. I'm checking with RM whether it has any of this functionality.

    Windows created something for that.

    How can I limit the number of allowed concurrent sessions per user in an Active Directory (AD) domain?

  7. #22

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,694
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by rslulz View Post
    All of these scripts, and extra software isn't needed... Just KISS keep it simple..... pull up command prompt [net session] you can view all current sessions via username there. If you know the location of his connection ip/mac/host name just boot him via dhcp.

    Disconnect sessions from a given machine
    NET SESSION \\ComputerName /DELETE
    Think you missed some posts out There's two questions, one was forcing people off which was answered awhile ago. And the later one is about limiting logons to one at a time, thus the scripts.

    Steve

  8. #23

    Join Date
    Mar 2012
    Location
    US
    Posts
    56
    Thank Post
    5
    Thanked 3 Times in 3 Posts
    Rep Power
    5
    Quote Originally Posted by Steve21 View Post
    Think you missed some posts out There's two questions, one was forcing people off which was answered awhile ago. And the later one is about limiting logons to one at a time, thus the scripts.

    Steve
    I answered both questions in two replies sorry for the confusion.

    Robert

    ps: Another way to easily see/end sessions:
    Server>Roles>File Services>Share and Storage Manager>Manage Sessions/Manage Open Files

    I hope I've helped.
    Last edited by rslulz; 19th November 2012 at 04:20 PM.

  9. #24
    levell3r's Avatar
    Join Date
    Jan 2011
    Location
    west mids
    Posts
    32
    Thank Post
    4
    Thanked 5 Times in 5 Posts
    Rep Power
    8
    steve21,
    any pointers for setting the script to check log file contents?

  10. #25
    levell3r's Avatar
    Join Date
    Jan 2011
    Location
    west mids
    Posts
    32
    Thank Post
    4
    Thanked 5 Times in 5 Posts
    Rep Power
    8
    Sorry for the double post. dont seem to be able to delete or edit posts on this site O.o



    sorted it. thanks for the help steve21.
    added wildcard to the file check, and added machine name to file creation and deletion. So it checks if the user is logged on to any machine but only deletes it if its the one with the right computer name.


    @logon
    Code:
    rem  check for the logon file to exist
    IF EXIST \\curricsvr2\logs$\logonchecker\%username%*.log \\curricsvr2\netlogon\scripts\vbmessage.cmd
    
    rem create a log file of usage by username
    echo %computername% >> \\curricsvr2\logs$\logonchecker\%username%-%computername%.log

    @logoff
    Code:
    rem  file check clear
    del \\curricsvr2\logs$\logonchecker\%username%-%computername%.log

    Code:
     @echo MSGBOX "You are already logged on. Please log off that machine before starting a new session." > %temp%\TEMPmessage.vbs
    @call %temp%\TEMPmessage.vbs
     @Del %temp%\TEMPmessage.vbs /f /q
    
    sleep 3
    logoff.exe

    note:
    vbmessage could just be replaced with any command, ie - shutdown.exe

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 1
    Last Post: 14th July 2010, 09:20 AM
  2. User Account Random Logoff
    By cgiuk in forum Windows Server 2008
    Replies: 0
    Last Post: 23rd April 2010, 09:31 AM
  3. Replies: 4
    Last Post: 22nd September 2009, 12:15 PM
  4. Bulk user creation
    By Dos_Box in forum How do you do....it?
    Replies: 63
    Last Post: 13th November 2006, 07:02 PM
  5. New users
    By Dos_Box in forum General Chat
    Replies: 4
    Last Post: 3rd July 2005, 09:44 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •