{"id":362,"date":"2019-05-22T20:21:34","date_gmt":"2019-05-22T19:21:34","guid":{"rendered":"https:\/\/blog.van-daag.nl\/?p=362"},"modified":"2020-08-04T12:24:26","modified_gmt":"2020-08-04T11:24:26","slug":"install-fonts-with-powershell","status":"publish","type":"post","link":"https:\/\/van-daag.nl\/?p=362","title":{"rendered":"Install Fonts with Powershell"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell line-numbers\">$ssfFonts = 0x14\n\n$fontSourceFolder = \"\"\n\n$Shell = New-Object -ComObject Shell.Application\n\n$SystemFontsFolder = $Shell.Namespace($ssfFonts)\n\n$FontFiles = Get-ChildItem $fontSourceFolder\n\n$SystemFontsPath = $SystemFontsFolder.Self.Path\n\n$rebootFlag = $false\n\n \n\nforeach($FontFile in $FontFiles) {\n\n    # $FontFile will be copied to this path:\n\n    $targetPath = Join-Path $SystemFontsPath $FontFile.Name\n\n    # So, see if target exists...\n\n    if(Test-Path $targetPath){\n\n        # font file with the same name already there.\n\n        # delete and replace.\n\n        $rebootFlag = $true\n\n        Remove-Item $targetPath -Force\n\n        Copy-Item $FontFile.FullName $targetPath -Force\n\n    }else{\n\n        #install the font.\n\n        $SystemFontsFolder.CopyHere($FontFile.fullname)\n\n    }\n\n}\n\n \n\n#Follow-up message\n\nif($rebootFlag){\n\n    Write-Host \"At least one existing font overwritten. A reboot may be necessary.\"\n\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[11,1,19],"tags":[],"class_list":["post-362","post","type-post","status-publish","format-standard","hentry","category-powershell-script","category-uncategorized","category-windows-10"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts\/362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=362"}],"version-history":[{"count":12,"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts\/362\/revisions"}],"predecessor-version":[{"id":417,"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts\/362\/revisions\/417"}],"wp:attachment":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}