none
Windows 7 Fonts Deploy Script RRS feed

  • Question

  • I am having problems installing fonts on Windows 7 and I found your post for scripting fonts but need a little help. The end goal is to add this to my sccm TS.

    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace("c:\pb-fonts")
    Set objFolderItem = objFolder.ParseName("SWMEDITL_0.TTF")
    Set objFolderItem = objFolder.ParseName("SWBLACK_0.TTF")
    Set objFolderItem = objFolder.ParseName("SWBLKITL_0.TTF")
    Set objFolderItem = objFolder.ParseName("SWLIGHT_0.TTF")
    Set objFolderItem = objFolder.ParseName("SWLTOB_0.TTF")
    Set objFolderItem = objFolder.ParseName("SWMED_0.TTF")
    Set objFolderItem = objFolder.ParseName("SWMEDBI_0.TTF")
    Set objFolderItem = objFolder.ParseName("SWMEDBLD_0.TTF")
    objFolderItem.InvokeVerb("Install")

    Windows Script Host
    Script: C:\PB-Fonts|PB-Fonts.vbs
    Line: 11
    Char: 1
    Error: Object required: objFolderItem
    Code: 800A01A8

     

    Tuesday, February 15, 2011 2:13 PM

Answers

  • can you post your complete script?

    you may have to change ur line "Set objFolder = objShell.Namespace("c:\pb-fonts")" and put fonts instead of "c:\pb-fonts", since this is not a namespace

    here is a way of doing it:

    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
    

     

     


    Thiyagu | MCTS/MCITP - Exchange 2007 | MCSE 2003[Messaging] | http://www.myExchangeWorld.com. This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, February 15, 2011 5:17 PM
    Moderator

All replies

  • can you post your complete script?

    you may have to change ur line "Set objFolder = objShell.Namespace("c:\pb-fonts")" and put fonts instead of "c:\pb-fonts", since this is not a namespace

    here is a way of doing it:

    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
    

     

     


    Thiyagu | MCTS/MCITP - Exchange 2007 | MCSE 2003[Messaging] | http://www.myExchangeWorld.com. This posting is provided "AS IS" with no warranties, and confers no rights.
    Tuesday, February 15, 2011 5:17 PM
    Moderator
  • Hi,

    Can u please explain me where the installation needs to be inserted. i followed this code and made my changes but not sure whats wrong.

    Const FONTS = &H14
     dim  oFSO,oShell, oFolder1, oFolder2, sRoot
     sRoot="C:\Users\m1009506\Desktop\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
    if right(sName,4)=".otf" then
       if not ofso.fileexists(oFolder1.self.path & "\" & sName) then
        oFolder1.copyhere sRoot & sName
       end if 
      end ifoFolder2.InvokeVerb("Install") 
     next

    Please guide!!!!

     

    Friday, March 18, 2011 10:59 AM
  • If you need a script that works in Windows 7 you can find it here:

    http://www.cloudtec.ch/blog/tech/install-font-command-line-script-windows-7.html

    you only have to adapt the path to the source folder of your fonts. Prob. stored on a server share.

    The script the will automatically install all the fonts that are in that folder.

     

    Cheers


    Thursday, August 11, 2011 8:39 PM
  • To automate this problem even further, I took a script similar to this and created a scheduled task that runs every 30 minutes. Users can put their fonts in a network location and it will automatically install them. The full set of instructions are here:

    http://deployhappiness.com/installing-fonts-with-powershell/


    If my answer helped you, check out my blog: DeployHappiness. Subscribe by RSS or email. 

    Tuesday, May 14, 2013 12:21 PM