簡體   English   中英

如何在用戶登錄時檢查Firefox插件是否存在?

[英]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 \\


  1. 我對Windows腳本一無所知,這是我什至第一次考慮
  2. 由於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提供了一個錯誤對話框,其中有大量示例。

祝好運!

這是一些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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM