字体未使用powershell脚本进行注册

时间:2014-10-29 12:00:26

标签: powershell fonts registry

我已经制作了这个脚本,将字体从服务器复制到计算机上的临时文件夹,然后安装它,但它复制并完成所有操作,但不会在注册表中注册字体。

#map network drive
$net = new-object -ComObject WScript.Network
$net.MapNetworkDrive("Y:", "\\address\c$", $false, "\username", "password")

#take away system attribute on font folder 
attrib -r -s "C:\Windows\Fonts"

#specify path location
$NetworkPath = "Y:\Users\Administrator\Desktop\fontsFolder\"
$LocalPath= "C:\FontsTesting\"

$objShell = new-object -comobject shell.application
$objFolder = $objShell.Namespace(0x14)

#Take a copy of the font folder from the server
 New-Item $LocalPath -type directory -Force
Copy-Item "$NetworkPath\*" $LocalPath

#Copy the directory of the local path to a temp value        
$Fontdir = dir $LocalPath

         foreach($File in $Fontdir) 
        {
          if ((Test-Path "C:\Windows\Fonts\$File") -eq $False)
            {
                $objFolderItem = $objFolder.ParseName($fontName)
                    if (!$objFolderItem)
                           {
                             $objFolder.CopyHere($File.fullname)
                           }
            }
        }


#add attributes back and delete mapped drive and remove temp font folder
remove-item $LocalPath -recurse -Force
attrib +r +s "C:\Windows\Fonts"
net use /delete Y:

字体都是不同的类型,所有不同的类型都不会注册。

感谢您的帮助

0 个答案:

没有答案