+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 25
Scripts Thread, Script To Install Fonts To Workstations in Coding and Web Development; Don't know if this will be of use to anyone here, but have created a small VB startup Script that ...
  1. #1
    Guest

    Script To Install Fonts To Workstations

    Don't know if this will be of use to anyone here, but have created a small VB startup Script that can be used to install new fonts.

    It just copies the files froma server and registers them.

    If anyone would like it ill post the code and instructions?

  2. #2
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,938
    Thank Post
    114
    Thanked 272 Times in 250 Posts
    Rep Power
    104

    Re: Script To Install Fonts To Workstations

    Sounds good. You should always post your code as it is a good reference for other people with similar projects.

  3. #3
    mark's Avatar
    Join Date
    Jun 2005
    Posts
    3,945
    Thank Post
    233
    Thanked 48 Times in 44 Posts
    Blog Entries
    2
    Rep Power
    45

    Re: Script To Install Fonts To Workstations

    Love to see it SYSMAN - thanks

  4. #4
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,790
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    117

    Re: Script To Install Fonts To Workstations

    Definitely useful... please do post it up...

  5. #5

    Join Date
    Mar 2006
    Posts
    537
    Thank Post
    2
    Thanked 3 Times in 2 Posts
    Rep Power
    18

    Re: Script To Install Fonts To Workstations

    Yes Sysman. Get your script out for the geeks

  6. #6
    Guest

    Re: Script To Install Fonts To Workstations

    Here goes - I hope this makes some sense.

    Create a Folder to house all your additional fonts on a network share e.g. \\%SERVERNAME%\%SHARE%\FONTS

    Copy the new font to that share e.g. Twiggy-Bold.ttf

    Install the new font onto a workstation.

    Using regedit browse to the following Key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts

    Make a note of the new fonts registry information.

    Add this new information to the VB script

    Create a new GPO and add the script to run at computer start up

    Assign to computers

    The font will be available after a restart of the PC with no need for an admin logon.

    To update the script quickly I just created a shortcut to the policy folder and then just copy the updated VB script when I have added new fonts.

    And here's the code

    Code:
    ' ****************************************************************************
    
    ' Copy Fonts From Network Share To C:\WINDOWS\FONTS Folder Of Workstation
    
    ' ****************************************************************************
    
    Set WshShell = CreateObject("WScript.Shell")
    
    WshShell.Run "xcopy.exe ""\\%SERVERNAME%\%SHARE \FONTS"" ""C:\windows\fonts"" /C /I /S /E /H /Y /Q", 1,True
    
    
    ' ****************************************************************************
    
    ' Imports The Registry Information For The New Fonts - Add A New Line For Each New Font
    
    ' Example : WshShell. RegWrite"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\%FONT REG KEY%", "%FONT REG KEY ENTRY%", "REG_SZ"
    
    ' ****************************************************************************
    
    Set WshShell = WScript.CreateObject("WScript.Shell")
    
    WshShell. RegWrite"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\Twiggy-Bold (TrueType)", "Twiggy-Bold.ttf", "REG_SZ"
    
    WshShell. RegWrite"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\Twiggy-Light (TrueType)", "Twiggy-Light.ttf", "REG_SZ"

  7. #7
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,790
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    117

    Re: Script To Install Fonts To Workstations

    Thanks for sharing... I suspect that's going to make life a lot easier

  8. #8
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,938
    Thank Post
    114
    Thanked 272 Times in 250 Posts
    Rep Power
    104

    Re: Script To Install Fonts To Workstations

    Thought this might be good for some people on the same topic it shows you how to make an installer for custom fonts.

    http://www.ryanvm.net/forum/viewtopi...d56886e79aa580

  9. Thanks to ChrisH from:

    reggiep (20th March 2014)

  10. #9

    Join Date
    Aug 2009
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    thanks

    Great work .. really informative .. and thanks a lot for sharing ..

  11. #10

    Join Date
    Aug 2009
    Posts
    3
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    thanks so much for useful info
    script install

  12. #11

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,144
    Thank Post
    113
    Thanked 518 Times in 447 Posts
    Blog Entries
    2
    Rep Power
    121
    Copying the fonts and writing the registry keys will work but sometimes seems to need a restart of Explorer (so if you run this at startup then the fonts will be there the next time the machine starts).

    The link from @chrish looks fine but it looks like hard work :-)

    MS provide scripting support for installing fonts - the code I've used is below. Basically, put any fonts you want installing in a server folder (\\server\share\fonts in the example) and then call this code as an extra sub-routine in your machine startup script.

    If you ever want to add a new font, just copy it to the server; next time the machines reboot they'll install it.

    Code:
    Sub InstallFonts
      on error resume next
      Const FONTS = &H14
      dim , oFSO,oShell, oFolder1, oFolder2, sRoot
      sRoot="\\server\share\fonts\"
      Set oShell = CreateObject("Shell.Application")
      set oFSO=createobject("scripting.filesystemobject")
      Set oFolder1 = oShell.Namespace(FONTS)
      set oFolder2=ofso.getfolder(sRoot)
      for each oFile in oFolder2.files
        sName=lcase(oFile.name)
        if right(sName,4)=".ttf" then
          if not ofso.fileexists(oFolder1.self.path & "\" & sName) then
            oFolder1.copyhere sRoot & sName
          end if
        end if
      next
      on error goto 0
    End Sub

  13. 5 Thanks to srochford:

    dhicks (10th August 2009), Jon_boy1984 (1st March 2012), ozydave (1st December 2009), projector1 (15th June 2010), stevenlong1985 (28th February 2011)

  14. #12

    dhicks's Avatar
    Join Date
    Aug 2005
    Location
    Knightsbridge
    Posts
    5,498
    Thank Post
    1,184
    Thanked 745 Times in 647 Posts
    Rep Power
    228
    Quote Originally Posted by srochford View Post
    Basically, put any fonts you want installing in a server folder (\\server\share\fonts in the example) and then call this code as an extra sub-routine in your machine startup script.
    Darn, I thought simply copying fonts into C:\Windows\Fonts was enough.

    --
    David Hicks

  15. Thanks to dhicks from:

    ozydave (1st December 2009)

  16. #13
    chrbb's Avatar
    Join Date
    Oct 2005
    Location
    Midlands
    Posts
    1,506
    Thank Post
    141
    Thanked 66 Times in 61 Posts
    Rep Power
    46
    Quote Originally Posted by srochford View Post
    Copying the fonts and writing the registry keys will work but sometimes seems to need a restart of Explorer (so if you run this at startup then the fonts will be there the next time the machine starts).

    The link from @chrish looks fine but it looks like hard work :-)

    MS provide scripting support for installing fonts - the code I've used is below. Basically, put any fonts you want installing in a server folder (\\server\share\fonts in the example) and then call this code as an extra sub-routine in your machine startup script.

    If you ever want to add a new font, just copy it to the server; next time the machines reboot they'll install it.

    Code:
    Sub InstallFonts
      on error resume next
      Const FONTS = &H14
      dim , oFSO,oShell, oFolder1, oFolder2, sRoot
      sRoot="\\server\share\fonts\"
      Set oShell = CreateObject("Shell.Application")
      set oFSO=createobject("scripting.filesystemobject")
      Set oFolder1 = oShell.Namespace(FONTS)
      set oFolder2=ofso.getfolder(sRoot)
      for each oFile in oFolder2.files
        sName=lcase(oFile.name)
        if right(sName,4)=".ttf" then
          if not ofso.fileexists(oFolder1.self.path & "\" & sName) then
            oFolder1.copyhere sRoot & sName
          end if
        end if
      next
      on error goto 0
    End Sub
    Tried this today - could I get it to work ? No!
    I created a new folder on the server called fonts, shared it, full control for everyone. Copied the script, changed the server path tested it and it worked. So copied the script to Group Policy (server 2008) computer's startup scripts, rebooted the machines and it doesn't work. I have other scripts that work in the same OU. Any ideas anyone?

  17. #14

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,144
    Thank Post
    113
    Thanked 518 Times in 447 Posts
    Blog Entries
    2
    Rep Power
    121
    Add in some debugging:
    Code:
    Sub InstallFonts
      on error resume next
      Const FONTS = &H14
      dim , oFSO,oShell, oFolder1, oFolder2, sRoot
      sRoot="\\server\share\fonts\"
      Set oShell = CreateObject("Shell.Application")
      set oFSO=createobject("scripting.filesystemobject")
    
    set oLog=ofso.createtextfile("c:\windows\temp\fonts.log",true)
    
      Set oFolder1 = oShell.Namespace(FONTS)
      set oFolder2=ofso.getfolder(sRoot)
      for each oFile in oFolder2.files
        sName=lcase(oFile.name)
    
    oLog.writeLine "found: " & sName
    
        if right(sName,4)=".ttf" then
          if not ofso.fileexists(oFolder1.self.path & "\" & sName) then
    
    oLog.writeLine "installing: " & sName
    
            oFolder1.copyhere sRoot & sName
          end if
        end if
      next
      on error goto 0
    
    oLog.close
    
    End Sub
    - add the "olog" lines and it should write a log file to c:\windows\temp\fonts.log with some info about what's happening.
    If that file doesn't get created then the script just isn't running. If it gets created and it appears to not find any fonts then your script isn't able to read the fonts directory (remember you must have "domain computers" with read access to get that to work)

  18. #15
    chrbb's Avatar
    Join Date
    Oct 2005
    Location
    Midlands
    Posts
    1,506
    Thank Post
    141
    Thanked 66 Times in 61 Posts
    Rep Power
    46
    Sorted thanks, added authenticated users to fonts folder!

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 18
    Last Post: 12th September 2013, 05:44 PM
  2. Installing/Copying Fonts from Login Script
    By mattpant in forum Windows
    Replies: 10
    Last Post: 11th August 2011, 09:24 PM
  3. Deploying Fonts
    By HodgeHi in forum Wireless Networks
    Replies: 7
    Last Post: 22nd April 2008, 11:10 AM
  4. Missing fonts in Publisher 2003
    By Kyle in forum Windows
    Replies: 1
    Last Post: 17th October 2007, 10:05 AM
  5. Help with Fonts
    By Mr_M_Cox in forum Windows
    Replies: 6
    Last Post: 10th September 2007, 11:17 AM

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •