Log Off

Discussion in 'Windows Desktop Systems' started by coathanger007, Aug 25, 2003.

  1. coathanger007

    coathanger007 Tomorrow Tweaking Today

    Messages:
    1,520
    Location:
    Australia
    How can I add a registry key whenever I log off? Any ideas?
     
  2. Vorpal

    Vorpal Guest

    OK ... I have to ask "why" you would want to do that.


    Maybe a batch file, or small Visual Basic EXE that could write the key and then start the logoff... ?
     
  3. Hematic

    Hematic Guest

    Yeah im hooked, what do you want a reg key added at logoff for?
     
  4. Enyo

    Enyo Moderator

    Messages:
    1,338
    You would want a visual basic script that writes the key then using the local group policy you would add the script as a log off script.

    I do something similar in my logoff script, but im not writing a value im removing one.

    gpedit.msc --> user config --> Windows Settings --> Scripts

    This presumes 2000/XP Pro of course. If your OS is not 2000 or XP we need to re-think this :)
     
  5. Vorpal

    Vorpal Guest

    Yeah... this has been driving me crazy. I can't think of a reason why someone would want to do this. :p
     
  6. Vorpal

    Vorpal Guest

    OK, so how would you do that in a vb script form then?

    Here's the MODULE I use for registry stuff when working with vb6, it has examples and maybe (?) would work in script form:
     
  7. Enyo

    Enyo Moderator

    Messages:
    1,338
    Code:
    Set objShell = WScript.CreateObject("WScript.Shell")
    objShell.RegDelete "HKCU\TestKey\Version"
    
    Or use objShell.RegWrite to write.

    Simple example.

    A few ways to do it depending on what exactly you want to add or remove.
     
  8. coathanger007

    coathanger007 Tomorrow Tweaking Today

    Messages:
    1,520
    Location:
    Australia
    Thanks everyone. What I was trying to do was run exe files at high priority in one of my users. When logging off/switching users, I wanted to disable this...will see if works now