General discussion

  • Creator
    Topic
  • #2190099

    Install Fonts, Stealth mode

    Locked

    by jackman775 ·

    Is there a way to install fonts without using the ControlPanel/Font applet? For instance, is there a way through a CLI script to do a stealth install of new fonts? I’m open to any suggestion that keeps me from going to each desktop to add new fonts. Thanks.

All Comments

  • Author
    Replies
    • #3070133

      Reply To: Install Fonts, Stealth mode

      by tben ·

      In reply to Install Fonts, Stealth mode

      I believe you can copy the font file into the font folder.. and that ought to do the trick

      Its easy if the users uses a login script

    • #3060344

      Reply To: Install Fonts, Stealth mode

      by jonathanpdx ·

      In reply to Install Fonts, Stealth mode

      I agree with tben. Copy the necessary files to the Fonts folder and Windows will recognize them. Since they’re just ‘files’ it can be performed like any other file transfer, scripted or otherwise.

    • #3060324

      Reply To: Install Fonts, Stealth mode

      by jackman775 ·

      In reply to Install Fonts, Stealth mode

      I had tried copying the new fonts to the fonts directory via a login script. I logged onto 3 test desktops. The files had been copied, as I set up the script to pause before finishing. However, there was no ability to use the fonts. They simply didn’t show up in the list. When forcing a manual install using Explorer using the File/Install New Fonts drop down from the menu, the install app shows that the fonts were indeed being overwritten. A perplexing problem to a simple task. I’m going back to try testing via a script and will report back once again.

    • #3046320

      Reply To: Install Fonts, Stealth mode

      by jcurrie ·

      In reply to Install Fonts, Stealth mode

      Unfortionatly, you can not remotely copy the files into the folder via script or otherwise. This is due to the fact that the fonts must be registered to work properly. If you are logged into the console of a workstation and you copy the font files into the windows\fonts directory, Windows will automatically register them. However, if you do this romotely or via script, Windows will not detect this and therefore will not resgister the fonts.

      You can acheive this via script though it is not as easy as you would think (or like it to be). Their are several considerations to make here.

      First this is usually easier accomplished with a login script instaed of a startup script. However, this introduces some complications in that login scripts run under the users credentials not the local system credentials. Therefore, unless your users have permissions to the file system AND have permissions to register fonts, the script will fail. This can be overcome by using impersonation in your script, BUT BEWARE, this means you will need to provide clear text login credientials for an administrative account in your script (this is very bad security practice). There are ways around this especially with .Net but now we are getting even more complexities which are out of the scope of this thread.

      Second. You will not only need to write the code to complete your file copy, but you will need to manually register the font as well. Basically this consists of writing a value to the registry under

      HKLM\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Fonts

      Below is a script that might do the trick for you. Please keep in mind that I HAVE NOT TESTED THIS. This was submited by one of my technicians to me some time ago and I have never used it. You will very likely need to do some tweaking and testing for your environment.

      • #3046318

        Reply To: Install Fonts, Stealth mode

        by jcurrie ·

        In reply to Reply To: Install Fonts, Stealth mode

        Just an FYI, I actually find it much easier to package my font distributions into an MSI. This is actually quite trivial, and would take far less time then tweaking and testing the script below. You can natively deploy the MSI to targeted computers through Group Policy. The only catch is that you need an MSI packager. Considering your time investment, that would likely be less expensive then tweaking and testing the script below as well.

        ‘ Start of script
        Option Explicit

        Dim strAddedFonts, updated, sComputer, fso, oReg, strRegValue, sFontName, sFontFile, strIFN

        Const HKLM = &H80000002

        sComputer = InputBox(“What is the computername “,”Register Fonts”,”COMPUTERNAME”,1,1)

        updated= “Following fonts have been”&vbCr &”registed on “&sComputer &vbCr &vbcr

        Set Fso = CreateObject(“Scripting.FileSystemObject”)

        Set oReg = GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & sComputer & “\root\default:StdRegProv”)

        strRegvalue = “SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts”

        sFontName = “Kartika (TrueType)”
        sFontFile =”Kartika.ttf”
        FontUpdate ()

        msgbox updated

        Function FontUpdate ()

        ‘ Place code here to copy files from central repository
        ‘ to the target PC

        strIFN = “\\”&sComputer &”\C$\Windows\Fonts\”&sFontFile

        If Fso.FileExists(strIFN) Then
        updated = updated & sFontFile &VbCr
        oReg.SetStringValue HKLM, strRegvalue, sFontName, sFontFile
        end if
        End function

        ‘ end of script

      • #3046291

        Reply To: Install Fonts, Stealth mode

        by jackman775 ·

        In reply to Reply To: Install Fonts, Stealth mode

        Poster rated this answer.

    • #3046289

      Reply To: Install Fonts, Stealth mode

      by jackman775 ·

      In reply to Install Fonts, Stealth mode

      This question was closed by the author

Viewing 4 reply threads