Announcement

Collapse
No announcement yet.

Installation of font on all computers

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Installation of font on all computers

    Hi,


    I am required to install new fonts on all computers in our AD domain. While going through the forum, I found the following thread and thought of trying it out.

    http://forums.petri.com/showthread.p...=install+fonts

    I have used the same script altering the name of the font and remote path but I am getting a VB script error message on the following line with cursor flashing after &

    if oFileSystem.FileExists (Windir & "\Fonts\dax-black.otf") = 0 then

    Error message is -> Microsoft VBScript compilation error: Expected ')'

    With my limited knowledge on vbscript, I could not figure out what is going wrong.


    Could Dumber or anyone who has implemented this, please help.


    Cheers,

    Pankajb

  • #2
    Re: Installation of font on all computers

    Well you should change the & to &.
    This is an issue due to a forum migration many years ago (somewhere in 2005).
    I've modified your the source.
    Last edited by Dumber; 9th September 2008, 09:49.
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

    Comment


    • #3
      Re: Installation of font on all computers

      You may also want to take a look at this thread
      http://forums.petri.com/showthread.php?t=24181
      Regards,
      Jeremy

      Network Consultant/Engineer
      Baltimore - Washington area and beyond
      www.gma-cpa.com

      Comment


      • #4
        Re: Installation of font on all computers

        Many thanks JeremyW & Dumber,

        The script of Dumber with & modified to &. is now running alright but now I am facing a different problem.

        The script finishes without installing any font. On carefully watching the command window on the desktop where the script if running, I had observed that there is a message stating that permission is denied.

        I checked that Administrator has full permission on the \WINDOWS folder on the desktop.

        Please suggest what else should I check.

        Cheers,

        Pankajb

        Comment


        • #5
          Re: Installation of font on all computers

          Check source, destionation and registry permissions
          Marcel
          Technical Consultant
          Netherlands
          http://www.phetios.com
          http://blog.nessus.nl

          MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
          "No matter how secure, there is always the human factor."

          "Enjoy life today, tomorrow may never come."
          "If you're going through hell, keep going. ~Winston Churchill"

          Comment


          • #6
            Re: Installation of font on all computers

            My source files are stored on the Files Server Share having following permissions

            Share
            Everyone - Full Control
            NTFS
            Administrator - Full Control
            CREATOR OWNER - Special Permission
            SYSTEM - Full Control
            Users - Read & Execute / List Folder Contents / Read

            The destination is Windows/fonts folder on XP SP2 Desktop and having the following permissions

            NTFS

            Administrator - Full Control
            CREATOR OWNER - Special Permission
            SYSTEM - Full Control
            Users - Read & Execute / List Folder Contents / Read

            Advanced Permission
            Traverse Folder / Execute File – Allow
            List Folder / Read Data – Allow
            Read Attributes – Allow
            Read Extended Attributes – Allow
            Read Permissions – Allow

            I have checked few desktops and found that all of them have the above permissions.

            Finally I granted the following Advanced permission to the Users group

            Create Files / Write Data – Allow

            To my astonishment, the fonts got installed.

            But now two question arises

            a) Is it alright to do so. If, no then what is the alternative.

            b ) If yes, then again I am down with a big job of changing the permissions of the font’s folder across all the desktop in the organization. Can this be done through a script or group policy.

            Please suggest.

            Cheers,

            Pankajb

            Comment


            • #7
              Re: Installation of font on all computers

              I think you are talking about C:\windows\fonts
              In that case, run it as a startup script.
              Marcel
              Technical Consultant
              Netherlands
              http://www.phetios.com
              http://blog.nessus.nl

              MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
              "No matter how secure, there is always the human factor."

              "Enjoy life today, tomorrow may never come."
              "If you're going through hell, keep going. ~Winston Churchill"

              Comment


              • #8
                Re: Installation of font on all computers

                Hi Dumber,

                Many thanks for your suggestion.

                I think you are talking about C:\windows\fonts
                In that case, run it as a startup script.
                Yes, I am trying to install few new fonts on the C:\windows\fonts folder on each desktop but I had never used startup script so require your guidance.

                Can I use the same vbscript as my startup script ?

                If yes, where do I place the script ie. Netlogon share or any other share.

                If no, then do I have to write a bat file to call the vbscript or a new bat file to write the fonts and add the registry entry?

                Cheers,

                Pankajb

                Comment


                • #9
                  Re: Installation of font on all computers

                  http://technet.microsoft.com/en-us/l.../cc179134.aspx
                  To assign computer startup scripts
                  Click Start, click Control Panel, click Administrative Tools, and click Group Policy Management.

                  In the console tree, double-click Group Policy Objects in the forest and domain that contains the Group Policy object (GPO) that you want to edit. This is located in Forest name/Domains/Domain name/Group Policy Objects.

                  Right-click the GPO you want to use to assign scripts and click Edit. This opens the Group Policy Object Editor console.

                  In Group Policy Object Editor, in the console tree, click Scripts (Startup/Shutdown). This is located in the Computer Configuration\Windows Settings node.

                  In the details pane, double-click Startup.

                  In the Startup Properties dialog box, click Add.

                  In the Add a Script dialog box, do the following:

                  In Script Name, type the path to the script, or click Browse to search for the script file in the Netlogon shared folder on the domain controller.

                  In Script Parameters, type the parameters you want to use as you would type them on the command line. For example, if your script included parameters called //logo (display banner) and //I (interactive mode), type: //logo //I.

                  In the Startup Properties dialog box, specify the options you want to use. The following options are available:

                  Startup Scripts for Group Policy object. Lists all the scripts that are currently assigned to the selected Group Policy object. If you assign multiple scripts, the scripts are processed in the order that you specify. To move a script up in the list, select the script and click Up. To move a script down in the list, select the script and click Down.

                  Add. Opens the Add a Script dialog box, where you can specify additional scripts to use.

                  Edit. Opens the Edit Script dialog box, where you can modify script information, such as name and parameters.

                  Remove. Removes the selected script from the Startup Scripts list.

                  Show Files. Displays the script files that are stored in the selected Group Policy object.

                  Specifying maximum time for startup scripts to run
                  To set the maximum time for startup scripts to run
                  Click Start, click Control Panel, click Administrative Tools, and click Group Policy Management.

                  In the console tree, double-click Group Policy Objects in the forest and domain that contains the Group Policy object (GPO) that you want to edit. This is located in Forest name/Domains/Domain name/Group Policy Objects.

                  Right-click the GPO you want to use to assign scripts and click Edit. This opens the Group Policy Object Editor console.

                  In Group Policy Object Editor, in the console tree, navigate to Computer Configuration\Administrative Templates\System\Scripts.

                  On the details pane (left side of the console), double-click the Maximum wait time for Group Policy scripts policy setting, click Enabled, enter the value you want to use in the Seconds scroll-down box, and then click OK.
                  Marcel
                  Technical Consultant
                  Netherlands
                  http://www.phetios.com
                  http://blog.nessus.nl

                  MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
                  "No matter how secure, there is always the human factor."

                  "Enjoy life today, tomorrow may never come."
                  "If you're going through hell, keep going. ~Winston Churchill"

                  Comment


                  • #10
                    Re: Installation of font on all computers

                    Hi Dumber,

                    I have run your modified vbscrit as a startup script and the font got installed.

                    Please accept my regards and million thanks for such a awesome and elaborate explanation.

                    Cheers,

                    Pankajb

                    Comment


                    • #11
                      Re: Installation of font on all computers

                      Great and your welcome
                      Marcel
                      Technical Consultant
                      Netherlands
                      http://www.phetios.com
                      http://blog.nessus.nl

                      MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
                      "No matter how secure, there is always the human factor."

                      "Enjoy life today, tomorrow may never come."
                      "If you're going through hell, keep going. ~Winston Churchill"

                      Comment


                      • #12
                        Re: Installation of font on all computers

                        Hi,
                        Thanks for all the help for guiding me to copy fonts.

                        The script from Dumber worked well for copying a single font.
                        However later I thought that why not modify the script to install additional fonts. I tested it with two fonts ie dax-black.otf","dax-bold.otf

                        Given below is the script.
                        When I run the script it only installs the first font defined in the array ie dax-black.otf.

                        I must accept that I have stolen the idea from Dumber & Rems but with my limited knowledge of vbscript I couldn’t make it work hence request you guys to kindly help.


                        Code:
                        Option explicit
                           
                          Dim objShell,objFileSystem,Windir,RemoteFontPath,FontKey,arrFonts,i
                           
                          Set objShell = WScript.CreateObject ("Wscript.Shell")
                           
                          Set objFileSystem = WScript.CreateObject ("Scripting.FileSystemObject")
                           
                          RemoteFontPath = ("\\findaaklfs001\MiscFonts$")
                           
                        ' "\\findaaklfs001\MiscFonts$" – this is our UNC path
                           
                          FontKey = ("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WIndows NT\CurrentVersion\Fonts")
                           
                          WinDir =objShell.ExpandEnvironmentStrings ("%windir%")
                           
                          arrFonts = Array("dax-black.otf","dax-bold.otf")
                           
                          For i= 0 To UBound(arrFonts)
                           
                          If objFileSystem.FileExists (Windir & "\Fonts\" & arrFonts(i))  = 0  then 
                           
                          ' copying file to the windir \ fonts dir
                           
                          objFileSystem.CopyFile RemoteFontPath & "\" & arrFonts(i), WinDir & "\fonts\" & arrFonts(i), True
                           
                          'setting regkey used by the font....reboot needed, but will not be forced. !!!!!!!!!!!!
                           
                          objShell.RegWrite FontKey & "\arrFonts(i) (OpenType)",arrFonts(i),"REG_SZ"
                           
                          End if 
                           
                          Next
                        Many thanks once again.

                        Cheers,

                        Pankajb
                        Last edited by Rems; 26th September 2008, 17:30. Reason: changed the Quote-tags around the code to Code-tags

                        Comment


                        • #13
                          Re: Installation of font on all computers

                          Although scripting is a very very long time ago I would make it more simple. Rems is way further then me so....
                          I would just copy the second if statement and replace the fontnames where needed. If it's just for 2 fonts.

                          However, I will move this topic to the scripting forum for a better response
                          Marcel
                          Technical Consultant
                          Netherlands
                          http://www.phetios.com
                          http://blog.nessus.nl

                          MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
                          "No matter how secure, there is always the human factor."

                          "Enjoy life today, tomorrow may never come."
                          "If you're going through hell, keep going. ~Winston Churchill"

                          Comment


                          • #14
                            Re: Installation of font on all computers

                            I was not able to test the script below!, but you can give it a try..

                            Code:
                            ' Computer Startup Script for installing fonts.
                            
                            With CreateObject("Shell.Application")
                              Const FONTS = &H14&
                              Set objFolder = .Namespace(FONTS)
                              sDestinationPath = objFolder.Self.path
                            End With
                            Set fso = CreateObject("Scripting.fileSystemObject")
                            
                            ' valid fonttypes for the install method that is being used are ttf and otf
                            fontsource = "\\uncpath\MiscFonts$"
                            InstallFontType "ttf"
                            InstallFontType "otf"
                            
                            'wscript.quit
                            
                            
                            Sub InstallFontType(FontType)
                            ' www.microsoft.com/technet/scriptcenter/resources/qanda/apr08/hey0425.mspx
                               Set FileCollection = fso.GetFolder(fontsource & "\")
                               FontType = LCase(FontType)
                               For Each objFile In FileCollection.Files
                            
                                  strSourceFile = LCase(objFile.path)
                                  If fso.GetExtensionName(strSourceFile) = FontType Then
                            
                                     strDestinationFile = sDestinationPath & "\" & objFile.name
                                     If NOT fso.FileExists(strDestinationFile) _
                                        Then objFolder.CopyHere strSourceFile
                            
                                  End If
                               Next
                               Set FileCollection = Nothing
                            end sub
                            \Rems
                            Last edited by Rems; 26th September 2008, 20:00.

                            This posting is provided "AS IS" with no warranties, and confers no rights.

                            __________________

                            ** Remember to give credit where credit's due **
                            and leave Reputation Points for meaningful posts

                            Comment


                            • #15
                              Re: Installation of font on all computers

                              Hi Dumber and Rems,

                              I have tested the script and it works like a charm.

                              No words to express how happy I am.

                              Pls accept my thanks...

                              Cheers,

                              Pankajb

                              Comment

                              Working...
                              X