-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathUninstall_Font.ps1
More file actions
29 lines (22 loc) · 890 Bytes
/
Uninstall_Font.ps1
File metadata and controls
29 lines (22 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<#
===========================================================================
Created on: 04/07/2020 13:06
Created by: Ben Whitmore
Organization: -
Filename: Uninstall_Font.ps1
===========================================================================
Version:
1.0
#>
#Set Current Directory
$ScriptPath = $MyInvocation.MyCommand.Path
$CurrentDir = Split-Path $ScriptPath
#Set Font Reg Key Path
$FontRegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"
#Grab the Font from the Current Directory
foreach ($File in $(Get-ChildItem -Path $CurrentDir -Include *.ttf, *.otf, *.fon, *.fnt -Recurse)) {
#Remove the Font from the Windows Font Directory
Remove-Item (Join-Path "C:\Windows\Fonts\" $File.Name) -Force | Out-Null
#Remove the corresponding Registry Key
Remove-ItemProperty -Path $FontRegPath -Name $File.Name | Out-Null
}