Guybrush3pwood Posted April 28, 2016 Posted April 28, 2016 Not sure if this is even possible, but we're trying to add a site to trusted sites in Firefox, but in order to do so, we need to modify the prefs.js file in the profile folder under "profiles." Problem is, we want to make this change to all the machines on our network, but because Firefox gave random profile names to each user, we need to either use a wild card, or make a scrip that can pull the user id from the profiles.ini file and input it into the script with an append function. Anyone know how I can accomplish this? Seems to be quite difficult.
psydii Posted April 28, 2016 Posted April 28, 2016 Never done it, but this page might help: https://4sysops.com/archives/group-policy-for-firefox-and-chrome/
Guybrush3pwood Posted April 28, 2016 Author Posted April 28, 2016 I was actually able to figure it out, but now for the last piece of the puzzle. I need the script to check for the lines I want to write before they're written and quit the script if it detects the string or continue if it doesn't. How would I do that?
Guybrush3pwood Posted April 28, 2016 Author Posted April 28, 2016 Here's where I'm at. It keeps telling me "expected end." Where am I going wrong? dim filesys, filetxt, strSearchFor strSearchFor = "pref(""network.negotiate-auth.trusted-uris"", ""dl-okoar-01.chikentime.local"");" Const ForReading = 1, ForWriting = 2, ForAppending = 8 Set filesys = CreateObject("Scripting.FileSystemObject") Set objFile = filesys.OpenTextFile("C:\Program Files (x86)\Mozilla Firefox\defaults\pref\channel-prefs.js", ForReading) If InStr(strLine, strSearchFor) = True Then Set filetxt = Nothing If Not found then Set filetxt = filesys.OpenTextFile("C:\Program Files (x86)\Mozilla Firefox\defaults\pref\channel-prefs.js", ForAppending, True) filetxt.WriteLine("pref(""network.negotiate-auth.trusted-uris"", ""dl-okoar-01.chikentime.local"");") filetxt.WriteLine("pref(""network.automatic-ntlm-auth.allow-non-fqdn"", true);") filetxt.WriteLine("pref(""network.negotiate-auth.allow-non-fqdn"", true);") filetxt.Close End If
Guybrush3pwood Posted April 28, 2016 Author Posted April 28, 2016 Try as I might, i can't get it to detect strings of text, and then stop the script when detected. Could use some help.
Guybrush3pwood Posted April 29, 2016 Author Posted April 29, 2016 Maybe it's not clear what I'm trying to do?
howartp Posted April 29, 2016 Posted April 29, 2016 (edited) I'm not overly familiar with vbscript, versus other languages, but try this approach: dim filesys, filetxt, strSearchFor strSearchFor = "pref(""network.negotiate-auth.trusted-uris"", ""dl-okoar-01.chikentime.local"");" Const ForReading = 1, ForWriting = 2, ForAppending = 8 Set filesys = CreateObject("Scripting.FileSystemObject") Set objFile = filesys.OpenTextFile("C:\Program Files (x86)\Mozilla Firefox\defaults\pref\channel-prefs.js", ForReading) If Not InStr(strLine, strSearchFor) = True Then Set filetxt = filesys.OpenTextFile("C:\Program Files (x86)\Mozilla Firefox\defaults\pref\channel-prefs.js", ForAppending, True) filetxt.WriteLine("pref(""network.negotiate-auth.trusted-uris"", ""dl-okoar-01.chikentime.local"");") filetxt.WriteLine("pref(""network.automatic-ntlm-auth.allow-non-fqdn"", true);") filetxt.WriteLine("pref(""network.negotiate-auth.allow-non-fqdn"", true);") filetxt.Close End If I would also expect that "If Not InStr(strLine, strSearchFor) = True Then" can be shortened to "If Not InStr(strLine, strSearchFor) Then" but again that might be how VBscript needs it. Also, have you intentionally misspelt "chickentime" as "chikentime"? Peter (Edit: Corrected the tabbing that didn't apply when I hit post) Edited April 29, 2016 by howartp
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now