none
Windows Schriftarten Installieren XP Visual Basic Script RRS feed

  • Frage

  • Hallo TechNet,

    ich habe folgendes Skript gefunden und würde es gern für meine Umgebung verwenden. Dieses Skript wird per GPO (Computer) als Start Skript ausgeführt. Bei der ersten Ausführung funktioniert alles wunderbar. Wird es nun erneut ausgeführt kommt eine Meldung das die Schriftarten bereitsvorhanden sind und deinstalliert werden müssten bevor die Schriftarten installiert werden können.

    Aber wenn ich das Skript richtig verstehe darf das garnicht passieren wegen folgender Zeilen:

    For Each oFont In oFolderCopy.Items
    
    If NOT oFSO.FileExists(strFontsPath & "\" & oFont.Name) Then
    
    ' Tell Explorer to copy the Font - this correctly installs it.
    
    oApp.Namespace(strFontsPath).CopyHere oFont
    
    



    Wenn ich das Skript jedoch manuell ausführe kommt keine Meldung.

    Wenn ich das Skript als GPO (User Anmelde) Skript laufen lasse funktioniert alles. So werde ich es dann wohl auch machen. Es wäre doch unglaublich interessant wie ich das ganze als Computer GPO laufen lassen kann.


    Ich bin für jede Idee offen. Vielleicht auch was ich noch ausprobieren soll.


    "' ###########################################
    
    ' # installfont.vbs #
    
    ' # installs font file in windows fonts dir #
    
    ' # (c) 2007 by Gottfried Mayer #
    
    ' ###########################################
    
    Const FONTS = &H10&
    
    
    
    Dim oFSO, oApp, oFolderCopy, oShell
    
    Dim strFontsPath, strScriptPath
    
    
    
    ' Create needed Objects
    
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    
    Set oShell = CreateObject("WScript.Shell")
    
    Set oApp = CreateObject("Shell.Application")
    
    
    
    ' Get Path of this Script (i.E. C:\Scripts\)
    
    strScriptPath = WScript.ScriptFullName
    
    strScriptPath = left(strScriptPath,instrrev(strScriptPath,"\"))
    
    
    
    ' Get Path of Windows Fonts directory
    
    strFontsPath = oShell.ExpandEnvironmentStrings("%WINDIR%") & "\Fonts"
    
    
    
    ' Get Folder Object of Fonts directory (i.E. C:\Scripts\FontsToInstall )
    
    Set oFolderCopy = oApp.Namespace(strScriptPath & "FontsToInstall")
    
    
    
    ' Check each Font if it already is installed
    
    For Each oFont In oFolderCopy.Items
    
    If NOT oFSO.FileExists(strFontsPath & "\" & oFont.Name) Then
    
    ' Tell Explorer to copy the Font - this correctly installs it.
    
    oApp.Namespace(strFontsPath).CopyHere oFont
    
    End If
    
    Next
    
    
    
    ' Cleanup Objects
    
    Set oFolderCopy = Nothing
    
    Set oApp = Nothing
    
    Set oShell = Nothing"
    
    
    
    

     

    Gruß und Dank

    Patrick



     

     

    Montag, 29. August 2011 14:19