Problem Install Fonts VBS Script Help

Discussion in 'Scripting & Programming' started by TechTock, Apr 2, 2013.

  1. TechTock

    TechTock Byte Poster

    101
    2
    39
    I've been asked to install fonts on everyone's Windows 7 machine and the script I've got and modified seems to do the trick apart from if the fonts are already installed it will prompt the user to install each one. How can I add to the script to check if the fonts exist and then exit the script. Also a box appears when it's installing the fonts. Is there a way to run this silently?

    As you can probably tell scripting isn't my thing. Any help much appreciated.

    Code:
     Dim objShell, objFSO, wshShell
     Dim strFontSourcePath, objFolder, objFont, objNameSpace, objFile
    
     Set objShell = CreateObject("Shell.Application")
     Set wshShell = CreateObject("WScript.Shell")
     Set objFSO = createobject("Scripting.Filesystemobject")
    
    strFontSourcePath = "\\ne1nvirpfil01\install\install\fonts\lato\"
    
     If objFSO.FolderExists(strFontSourcePath) Then
    
     Set objNameSpace = objShell.Namespace(strFontSourcePath)
     Set objFolder = objFSO.getFolder(strFontSourcePath)
    
     For Each objFile In objFolder.files
      If LCase(right(objFile,4)) = ".ttf" OR LCase(right(objFile,4)) = ".otf" Then
        Set objFont = objNameSpace.ParseName(objFile.Name)
        objFont.InvokeVerb("Install")
        Set objFont = Nothing
      End If
     Next
     Else
      Wscript.Echo "Font Source Path does not exists"
     End If
     
    Certifications: A+ | Network+ | Security+ | MCP | MCDST | MCTS: Hyper-V | MCTS: AD | MCTS: Exchange 2007 | MCTS: Windows 7 | MCSA: 2003 | ITIL Foundation v3 | CCA: Xenapp 5.0 | MCITP: Enterprise Desktop Administrator | MCITP: Enterprise Desktop Support Technician | PRINCE2 Foundation | VCP5
    WIP: Having a rest :-)

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.