-
-
Save sionta/59499c4d2b0c9ef04a94b296e6bc7455 to your computer and use it in GitHub Desktop.
Font User Installation - Powershell (No Admin Password Needed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run this as a Computer Startup script to allow installing fonts from C:\InstallFont\ | |
# Based on http://www.edugeek.net/forums/windows-7/123187-installation-fonts-without-admin-rights-2.html | |
# Run this as a Computer Startup Script in Group Policy | |
# Full details on my website - https://mediarealm.com.au/articles/windows-font-install-no-password-powershell/ | |
$SourceDir = "C:\InstallFont\" | |
$Source = "C:\InstallFont\*" | |
$Destination = (New-Object -ComObject Shell.Application).Namespace(0x14) | |
$TempFolder = "C:\Windows\Temp\Fonts" | |
# Create the source directory if it doesn't already exist | |
New-Item -ItemType Directory -Force -Path $SourceDir | |
New-Item $TempFolder -Type Directory -Force | Out-Null | |
Get-ChildItem -Path $Source -Include '*.ttf','*.ttc','*.otf' -Recurse | ForEach { | |
If (-not(Test-Path "C:\Windows\Fonts\$($_.Name)")) { | |
$Font = "$TempFolder\$($_.Name)" | |
# Copy font to local temporary folder | |
Copy-Item $($_.FullName) -Destination $TempFolder | |
# Install font | |
$Destination.CopyHere($Font,0x10) | |
# Delete temporary copy of font | |
Remove-Item $Font -Force | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment