Looking for way to log out of Windows when Firefox is closed

Posted on 2013-06-07
Last Modified: 2013-06-17
I'm setting up some training computers running on Windows 7 Pro, I'll be using Firefox with Site Block Plus, and Public Fox

One thing I'd like to add is that when a user closes Firefox, they get logged out of Windows as well.

Any thoughts?
Question by:ITDharam
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

by:Esteban Blanco
ID: 39230518
You could write a log off script that runs as a scheduled task when the users closes firefox.exe *32

Just a thought.

Author Comment

ID: 39230541
Sounds reasonable, can you expand on that?  I've never setup a task that is based on a running process.

Expert Comment

ID: 39230578
you could use powershell to do this:

have a startup script that launches firefox and then logs the user out when it is closed:

$firefox = "c:\program files\firefox\firefox.exe" #replace with your working path
$process = start-process $firefox -passthru

}while(get-process -id $
shutdown /L

Open in new window

LVL 16

Accepted Solution

cantoris earned 500 total points
ID: 39231553
That's a nice script except it has a "busy loop" in it.

You could use VBScript and a WMI Asynchronous query that watches for process deletion.

Or a much easier variation of the same method can be done using PowerShell 2 and its Register-WMIEvent cmdlet.

Either method would use a WQL query for an "__InstanceDeletionEvent" of a "Win32_Process".

Here's a simple PowerShell example:
$wql = "SELECT * FROM __InstanceDeletionEvent WITHIN 5 WHERE TargetInstance ISA 'Win32_Process' and TargetInstance.Name='firefox.exe'"

Register-WmiEvent -Query $wql -Action { Write-Host "Firefox closed." }

Open in new window


Author Closing Comment

ID: 39253836
Works a charm!

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question