Script Schriftarten installieren powershell

Ich habe ein Skript installiert eine schriftart, nach der überprüfung, ob die Schriften vorhanden sind oder nicht. Allerdings hab ich Probleme mit der Validierung der Existenz der Schrift.

$FONTS = 0x14;

$FromPath = "c:\fonts";

$ObjShell = New-Object -ComObject Shell.Application;
$ObjFolder = $ObjShell.Namespace($FONTS);

$CopyOptions = 4 + 16;
$CopyFlag = [String]::Format("{0:x}", $CopyOptions);

foreach($File in $(Get-ChildItem -Path $FromPath)){
    If ((Test-Path "c:\windows\fonts\$($File.name)") -eq $False)
    { }
    Else
    {
        $CopyFlag = [String]::Format("{0:x}", $CopyOptions);
        $ObjFolder.CopyHere($File.fullname, $CopyOptions);

        New-ItemProperty -Name $File.fullname -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts" -PropertyType string -Value $File 
    }
}
  • was genau ist dein problem?
  • der Fehler ist in der (sonst), kommt eine Meldung, ersetzen Sie die vorhandenen Schriftarten . Sollte dies nicht passieren, weil (sonst), sollte die Installation der Schriften, die nicht existieren !
InformationsquelleAutor MeuChapeu | 2014-11-04
Schreibe einen Kommentar