Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

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

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
ITDharam
Asked:
ITDharam
1 Solution
 
Esteban BlancoCommented:
You could write a log off script that runs as a scheduled task when the users closes firefox.exe *32

Just a thought.
0
 
ITDharamAuthor Commented:
Sounds reasonable, can you expand on that?  I've never setup a task that is based on a running process.
0
 
BT15Commented:
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
 
cantorisCommented:
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
 
ITDharamAuthor Commented:
Works a charm!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now