Reports on default home pages for Mozilla Firefox and Google Chrome
Hi all,
I have been asked to create a report of all workstations's default home pages for Mozilla Firefox and Google Chrome.
For Firefox I found that the default home page is stored in this file:
%AppData%\Mozilla\Firefox\Profiles\[randomly generated].default\prefs.js
and is in this line:
user_pref("browser.startup.homepage");
I think Google Chrome's isĀ
%LocalAppData%\Local\Google\Chrome\User Data\Default\Preferences"
and is in a "homepage" value but is in what seems like a hexadecimal value.
I have 2 questions about these 2 web browsers I was hoping someone could help me with:
1) How can I create a report of all the default home pages for these two web browsers? I do have a K1000.
2) How do I set the default home page for Google Chrome? I think I know how to set the home page for Mozilla Firefox.
Many thanks in advance.
0 Comments
[ + ] Show comments
Answers (2)
Answer Summary:
Please log in to answer
Posted by:
StockTrader
8 years ago
Top Answer
Hello,
I think that you need to create a script that looks for every user in your computer, interpreters the Preferences files and writes the results in a single text file.
Then you need to create a CIR (K1000 Custom Inventory Rule) to read the content of that file so that it can be reported in a custom field.
I can give some tips..
First of all the Preferences file of Chrome is in JSON and so we need to interpreter it.
One of the possible ways is to use PowerShell
The script needs to:
- Look for all the users subdirectories in C:\users
- for each directory if the C:\Users\%user%\AppData\Local\Google\Chrome\User Data\Default\Preferences exists parse it
- append the default pages settings to a text file (e.g. : C:\settings\settings.txt )
Tip for the point 1: play with something like Get-ChildItem c:\users| where {$_.PsIsContainer}
Tip for the point 2: to interpreter a JSON file with PowerShell you can use something like
$ch = ConvertFrom-Json -InputObject (Get-Content .\Preferences -raw)
The property you're looking for is $ch.session.startup_urls
For the CIR:
you can create a new software (Inventory -> Software -> Choose action -> New), name it something like Chrome defaults and use the following rule ShellCommandTextReturn(cmd /c type C:\settings\settings.txt)
Remember to select all the platform where you like to have the CIR running in the Supported Operating Systems section of the Software record.
Kind regards,
StockTrader - Marco
Posted by:
StockTrader
8 years ago
Bonus example PowerShell script:
Get-ChildItem c:\users|
where {$_.PsIsContainer} |
foreach {
$PrefFileName = $_.FullName+'\AppData\Local\Google\Chrome\User Data\Default\Preferences'
try {
$ch = ConvertFrom-Json -InputObject (Get-Content $PrefFileName -raw)
Out-File -filepath c:\Chromato.txt -Append -InputObject $PrefFileName
Out-File -filepath c:\Chromato.txt -Append -InputObject $ch.session.startup_urls
}
catch {"File not there or not parsable"}
}