简体   繁体   中英

How do I check, at user logon, if a Firefox plugin exists?

I want to check if the users on our domain have a certain Firefox plugin installed. Maybe we can have a script that checks if the folders created by the plugin exist . And if not raise some sort of alert to the user.

An example of the plugin folder is below. There are randomly generated parts that will probably make it more complicated.

C:\\Documents and Settings\\username\\Application Data\\Mozilla\\Firefox\\Profiles{random}.{profile name (“default”)}\\ {random-id}@jetpack\\resources{same random-id}-at-jetpack-pluginname-data\\


  1. I have NO clue about Windows scripting, this is the first time I'm even thinking about it
  2. This question is a bit of a "please do it for me" because of 1.

Is this possible? Definitely. I'm not sure the best method, but I'll attack this from the PowerShell angle.

It might be difficult to use PowerShell because you need to verify that everyone has PowerShell installed. If you can verify that, it's a pretty simple request.

Use

$firefoxfiles = Get-ChildItem -Path ($env:appdata + "\Mozilla\Firefox\Profiles") -Recurse

This will give you a list of all the files in that directory... treat all of the code in this answer as an example, you'll certainly have to change it.

if (!($firefoxfiles | Where-Object {$_.Name -eq "PluginFileName"} ) {
...code for pop up...}

There's a ton of samples out there for an error dialog from PowerShell.

Good luck!

Here is some PowerShell that will search the appdata directory for all folders containing that special plugin name. On error, you should alert the user and force them to interact with the alert (the Read-Host ). When they continue, you can launch Firefox directly to the installer page.

if(-not(Get-ChildItem "$env:appdata\Mozilla\Firefox" -recurse -include "*@jetpack" | ?{ $_.PSIsContainer }))
{
    Read-Host "The Firefox 'jetpack' plugin was not found. You will be redirected to the plugin page now. Please install the 'jetpack' plugin. (press any key to continue)"
    & 'path\to\firefox.exe' 'http:\\path.to.plugin.com'
}

The output on the console should look something like

The Firefox 'jetpack' plugin was not found. You will be redirected to the plugin page now. Please install the 'jetpack' plugin. (press any key to continue):

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM