2011-11-22 49 views
1

我想检查我们域上的用户是否安装了某个Firefox插件。也许我们可以有一个脚本,检查插件创建的文件夹是否存在。如果不提高某种警告给用户。如何在用户登录时检查Firefox插件是否存在?

插件文件夹的一个例子如下。有随机生成的部分可能会使它更复杂。

C:\ Documents and Settings \ username \ Application Data \ Mozilla \ Firefox \ Profiles {random}。{profile name(“default”)} \ {random-id} @jetpack \ resources {same random- ID}特技的喷气背包,pluginname数据\


  1. 我有关于Windows脚本不知道,这是第一次我甚至想着它
  2. 这个问题有点的“请为我做”,因为1.

回答

0

下面是一些PowerShell,它将搜索appdata目录中包含该特殊插件名称的所有文件夹。出现错误时,应提醒用户并强制他们与警报(Read-Host)进行交互。当它们继续时,您可以直接将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 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): 
+0

在技术方面一点,但我确定它。很好的想法马上启动Firefox到安装程序,甚至没有想到这种可能性。 – danneth

+0

我肯定会抛弃'Write-Error',在'Read-Host'中打印友好的东西(迫使用户响应警报),并启动firefox(我更新了答案)。我假设你已经熟悉了将脚本放在[startup](http://goo.gl/NWCeE)上运行的地方? –

1

这可能吗?当然。我不确定最好的方法,但是我会从PowerShell的角度来攻击它。

可能很难使用PowerShell,因为您需要验证是否每个人都安装了PowerShell。如果你可以验证,这是一个非常简单的请求。

使用

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

这会给你在该目录中的所有文件的列表...把所有的代码在这个答案作为一个例子,你肯定要改变它。

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

从PowerShell中可以看到大量的样本。

祝你好运!