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
Solved

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

Posted on 2013-06-07
5
379 Views
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?
0
Comment
Question by:ITDharam
5 Comments
 
LVL 8

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.
0
 
LVL 8

Author Comment

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

Expert Comment

by:BT15
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

do{
}while(get-process -id $process.id)
shutdown /L

Open in new window

0
 
LVL 16

Accepted Solution

by:
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

0
 
LVL 8

Author Closing Comment

by:ITDharam
ID: 39253836
Works a charm!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

860 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