batch file help

Discussion in 'OT Technology' started by phope, Apr 28, 2007.

  1. phope

    phope New Member

    Joined:
    Jan 6, 2007
    Messages:
    296
    Likes Received:
    0
    Hello, I need to make a batch file that will logoff a user in one hour of use.

    So would it be like this:

    @ECHO OFF


    C:
    logoff.exe


    ??

    I need help please!

    edit: I found an already made logoff C program, so now all I need is to figure out how to still wait one hour and then run logoff.exe.
     
    Last edited: Apr 28, 2007
  2. peerk

    peerk New Member

    Joined:
    Mar 14, 2005
    Messages:
    984
    Likes Received:
    0
    shutdown -l -t 3600

    Should do what you want, but for some reason the command is ignoring the time for me :dunno:

    So here is a vbscript:

    Code:
    Set WshShell = WScript.CreateObject("WScript.Shell")
    
    wscript.echo "You will be automatically logged off in 1 hour."
    
    WScript.Sleep(3600000)
    
    WshShell.Run "logoff"
    
    Note that all the user needs to do to remove the limit is kill the wscript.exe process.

    Also there probably is a better way to do this using group policy.
     
  3. phope

    phope New Member

    Joined:
    Jan 6, 2007
    Messages:
    296
    Likes Received:
    0
    Yes I also cannot get the shutdown command to work properly. How would I use the VB script? I've setup a GPO for the specific user and computer that I want to logoff, but it does not work. I've tried to set both user and computer policy settings....doesn't work. I'm trying to get a remote user to logoff in one hour from a remote desktop connection. This all has to be set when the user connects to the remote computer.
     
  4. phope

    phope New Member

    Joined:
    Jan 6, 2007
    Messages:
    296
    Likes Received:
    0
    bump
     
  5. phope

    phope New Member

    Joined:
    Jan 6, 2007
    Messages:
    296
    Likes Received:
    0
    I might be drunk, but I will seriously pay $20 dollars paypal instantly to the first person who helpes me complete this task thats needs to be done before Monday morning!!! L{PLASE
     
  6. Erus Vestrum

    Erus Vestrum New Member

    Joined:
    Mar 6, 2007
    Messages:
    19
    Likes Received:
    0
    This is technically border-line virus so it's illegal so unless it's just a friend, don't do it.
     
  7. Sexual Vanilla

    Sexual Vanilla New Member

    Joined:
    May 23, 2005
    Messages:
    6,305
    Likes Received:
    0
    Location:
    South Carolina
    :ugh:
     
  8. phope

    phope New Member

    Joined:
    Jan 6, 2007
    Messages:
    296
    Likes Received:
    0
    dude what are you talking about, I need this for work. I'm a noob sysadmin and this simple task has been freaking me out all week. I seriously need help by tomorrow. get your stupid head out of your ass erus
     
  9. Hate Crime

    Hate Crime Don't Hate OT Supporter

    Joined:
    Mar 12, 2006
    Messages:
    5,255
    Likes Received:
    0
    Location:
    Minnesota
    Set the task scheduler.
     
  10. Erus Vestrum

    Erus Vestrum New Member

    Joined:
    Mar 6, 2007
    Messages:
    19
    Likes Received:
    0
    Took me about a min to find it through google...
     

Share This Page