简体   繁体   English

如何在用户登录时检查Firefox插件是否存在?

[英]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. 我想检查我们域上的用户是否安装了某个Firefox插件。 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\\ C:\\ Documents and Settings \\用户名\\ Application Data \\ Mozilla \\ Firefox \\ Profiles {random}。{配置文件名称(“默认”)} \\ {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 我对Windows脚本一无所知,这是我什至第一次考虑
  2. This question is a bit of a "please do it for me" because of 1. 由于1,这个问题有点“请为我做”。

Is this possible? 这可能吗? Definitely. 绝对是 I'm not sure the best method, but I'll attack this from the PowerShell angle. 我不确定最好的方法,但是我将从PowerShell的角度进行攻击。

It might be difficult to use PowerShell because you need to verify that everyone has PowerShell installed. 使用PowerShell可能会很困难,因为您需要验证每个人都已安装PowerShell。 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. PowerShell提供了一个错误对话框,其中有大量示例。

Good luck! 祝好运!

Here is some PowerShell that will search the appdata directory for all folders containing that special plugin name. 这是一些PowerShell,它将在appdata目录中搜索包含该特殊插件名称的所有文件夹。 On error, you should alert the user and force them to interact with the alert (the Read-Host ). 如果发生错误,您应该向用户发出警报,并强迫他们与警报进行交互( Read-Host )。 When they continue, you can launch Firefox directly to the installer page. 当它们继续时,您可以直接将Firefox启动到安装程序页面。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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