Solved

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

Posted on 2013-06-07
5
380 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
[X]
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
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
OfficeMate Freezes on login or does not load after login credentials are input.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
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.

733 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