Very easy for some of you I think

(imported topic written by user-removed00191)

Hi,

I’ve been trying to create a relevance and I’ve try using the Inspector_Help.chm as a guide. Not sure how to tune this anymore

Relevance:

Q: content of file “hosts” of "{pathname of system folder & /drivers/etc/hosts}"contains “babproxy”

E: The operator “file” is not defined.

Basically I need to create relevance to check if “babproxy” exist in the hosts file before I run a task (modified from Ben task to edit hosts file):

waithidden cmd.exe /C echo “192.168.99.60 babproxy%0d%0a” >> {(pathname of system folder as string & “\drivers\etc\hosts”)}

Thanks in advance

(imported comment written by SystemAdmin)

Hi,

Try:-

exists (lines whose (it contains “babproxy” and it does not start with “#”) of file (pathname of system folder & “/drivers/etc/hosts”))

(imported comment written by user-removed00191)

Thanks cidermark… work like a charm!

Next I need to do is using the same relevance to modify firefox setting in prefs.js. By default the file is located in C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\u146a1c9.default.

prefs.js:

user_pref(“network.automatic-ntlm-auth.trusted-uris”, “babproxy”);

I know the file will be put inside every user profile (1st problem for me) and possible the profile is moved elsewhere (2nd problem for me). Firefox must not be in use for the file to be modified (3rd problem for me). Since there are so many problem for me, not sure how to go about this.

The manual way to do this is open firefox, go to about:config and change the line value user_pref(“network.automatic-ntlm-auth.trusted-uris”, " "). But I can’t do it manually to all.

Any help is really appreciated.

(imported comment written by user-removed00191)

Ok… after looking around the Internet with assistance from uncle Google, I found out a few things.

  1. The best way to modify prefs.js is by using user.js

  2. Default user profile folder can be reach via %appdata%\Mozilla\Firefox\Profiles*****.default

So now what I need is:

  1. Check every profile folder *****.default for user.js (Usually only one since this is already inside Windows User Profile folder)

  2. If user.js already exist, append it with user_pref(“network.automatic-ntlm-auth.trusted-uris”, “babproxy”);

  3. If user.js doesn’t exist, create the file and add user_pref(“network.automatic-ntlm-auth.trusted-uris”, “babproxy”); inside it.

Need advise everyone… please

(imported comment written by user-removed00191)

Really need help on this. can anyone advise

(imported comment written by NoahSalzman)

It would be a lot simpler just to have a standard enterprise-wide user.js and push it out to everyone. Can you do that?

Here is what the Mozilla developer site has to recommend about enforcing these settings:

A systems administrator can modify the default preferences in two ways:

The administrator may edit the all.js default pref file (install_directory/defaults/prefs/all.js). This has the advantage of changing the default value for both new and existing profiles. However, note preferences set in the profile will override the default settings. Also, note due to preferences file compression, some preferences are not saved if they match the default values, causing the profile to behave differently if used in a different installation.

The administrator may alternatively put a user.js file in app_dir/defaults/profile/ ; this will put a copy of the user.js in all new profiles. This method has the advantage of resetting preferences back to administrator defaults at every start-up. Note that, because a user typically has access privilege to his or her profile directory, he or she can change the default values if he or she knows how. Another disadvantage is that existing profiles will not be affected.

It seems that pushing out a standard all.js using the first approach is preferred if you want to ensure the settings are enforced.

(imported comment written by user-removed00191)

Thanks noah. Previously I tested that without success. Something is wrong with my syntax I guess. After going through mozilla dev website again and it seems to work now.

Really appreciate the assistance