[英]How do I check, at user logon, if a Firefox plugin exists?
我想检查我们域上的用户是否安装了某个Firefox插件。 也许我们可以有一个脚本来检查插件创建的文件夹是否存在 。 如果没有,则会向用户发出某种警报。
插件文件夹的示例如下。 有随机生成的部分可能会使它更加复杂。
C:\\ Documents and Settings \\用户名\\ Application Data \\ Mozilla \\ Firefox \\ Profiles {random}。{配置文件名称(“默认”)} \\ {random-id} @jetpack \\ resources {same random-id} -at-jetpack -pluginname-data \\
这可能吗? 绝对是 我不确定最好的方法,但是我将从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提供了一个错误对话框,其中有大量示例。
祝好运!
这是一些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):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.