How-to: Setup Firefox for use with Sharepoint NTLM Authentication
Preferred Editor: Notepad++
Microsoft VBScript: Language Reference
FFDeploy: Automated deployment of Firefox with extensions, themes, and pre-configuration
We don’t have many strict policies regarding installed applications at work; employees have their choice of web browser, for example. When it comes to using our Sharepoint intranet site, this poses a problem. By default Firefox will prompt the user for a username and password when attempting to login to the site, whereas Internet Explorer will automatically use built-in NTLM authentication to authenticate with the site using Active Directory.
Fortunately, Firefox can be setup to do this, however it does require some tweaking of sorts. In the about:config page, you’ll find an option called network.automatic-ntlm-auth.trusted-uris which will enable Firefox to use Windows’ built-in NTLM authentication; allowing users to simply open the Sharepoint site without hassle. Unfortunately, having to set this manually on all the computers on the network that were already using Firefox, plus the additional worry of setting this manually on any new systems or users who decide to use Firefox seemed like an annoying task.
I Googled for a solution, but unfortunately there weren’t any that immediately performed the actions I required. Fortunately though, there does exist a nice utility by the name of FFDeploy which I was able to take parts of — specifically, the VBScript — in order to make possible what I had envisaged.
Essentially, all my script does is check for the existence of a Firefox directory buried within Application Data of the user logging on; if this exists, we copy over a special user preferences file, user.js which overrides or appends to same-values set in the global prefs.js (reference).
The bulk of the script I will keep seperate, as it can be had by downloading FFDeploy. My simple use is as follows:
-
-
’script to setup FireFox on users pc’s with SharePoint NTLM auth
-
‘code borrowed from "FFDeploy"
-
‘licenced under Mozilla http://www.mozilla.org/MPL/
-
-
‘first create a FileSystemObject to manipulate files
-
Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
-
‘create a shell scripting object
-
Set SHO = WScript.CreateObject("WScript.Shell")
-
’some helper variables
-
AppData = SHO.ExpandEnvironmentStrings("%APPDATA%")
-
‘check to see if the user actually has Firefox installed & find the users local directory
-
If FSO.FileExists(AppData + "\Mozilla\Firefox\profiles.ini") Then
-
FFProfName = GetINIString("Profile0", "Path",,AppData + "\Mozilla\Firefox\profiles.ini")
-
FFProfName = Right(FFProfName, Len(FFProfName)-InStr(FFProfName,"/"))
-
FFProfPath = AppData + "\Mozilla\Firefox\Profiles\" + FFProfName
-
‘now copy our user.js preferences
-
FSO.CopyFile "G:\IT\clients\user.js", FFProfPath + "\", true
-
End If
-
‘user doesn’t have Firefox installed, do nothing
-
GetINIString is a function provided by the VBScript in the FFDeploy utility; though it would be relatively straightforward to reconstruct, or write a sub to perform the same action for this specific usage. The line FSO.CopyFile() near the bottom is where we actually copy the user.js file from the server. When the condition isn’t met, we simply exit the if block and do nothing.
Simple, huh?
No commentsHow-to: Re-Install Existing Printers on Windows using VBScript
Preferred Editor: Notepad++
Microsoft VBScript: Language Reference
Sometimes Windows, for reasons unknown, gets confused about printers. This is a problem in an office environment where people are printing almost non-stop. At my work we have about thirty employees, and in approximately six months, they’ve printed over 100 000 pages. I know this because one of the ink cartridges in the printer was recently replaced, and the printer keeps tabs on these kind of stats.
Anyway, an issue we sometimes encounter is that peoples printers simply don’t work. When they’re selected in the print dialogue of whatever application, the application locks up while the operating system tries to remember where the printer really is. I have no idea what causes this; if you do, please drop me a comment. In an effort to avoid this kind of behaviour, I’ve made an addition to our login script that removes and re-installs all the printers on the system. Hopefully by keeping the printers “fresh” in this way, I can avoid having peoples’ time wasted by silly, preventable printer problems.
The Script
-
-
’setup-printers.vbs
-
‘deletes and re-adds printers that already exist on the client system
-
Set objNetwork = CreateObject("WScript.Network")
-
‘the EnumPrinterConnections method returns an array containing the printer name and its UNC connection string
-
‘ood array indices are the names, even array indices are the connection strings
-
Set printers = objNetwork.EnumPrinterConnections
-
‘For all printers
-
For i = 0 to printers.Count-1 Step 2
-
Dim currentPrinter
-
‘Remove
-
currentPrinter = printers.Item(i+1)
-
If Left(currentPrinter, 2) = "\\" Then
-
‘ we have a network printer
-
On Error Resume Next
-
objNetwork.RemovePrinterConnection printers.Item(i+1)
-
Else
-
‘do nothing
-
End If
-
‘Re-add
-
currentPrinter = printers.Item(i+1)
-
If Left(currentPrinter, 2) = "\\" Then
-
‘ we have a network printer
-
On Error Resume Next
-
objNetwork.AddWindowsPrinterConnection printers.Item(i+1)
-
Else
-
‘do nothing
-
End If
-
Next
-
‘ setup the Edgeline as default printer
-
objNetwork.SetDefaultPrinter "\\springwood\HP CM8060 MFP with Edgeline PS"
-
Essentially, what the code does is grab the existing printer connections, delete them, and then re-add them. The in-code comments are enough to satisfy anyone with a web browser capable of looking up Microsoft’s VBScript references. What may not be immediately obvious is the last part — the script will re-add them in the order they existed, but without further input, will make the last added printer the default printer. This isn’t what we’re after at my workplace, therefore we need to fix that. However, I’ve just figured that in my particular instance I could re-add the printers in reverse — problem solved!
2 comments