-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGet-Installed-Fonts.ps1
executable file
·54 lines (47 loc) · 1.5 KB
/
Get-Installed-Fonts.ps1
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# https://powershell.org/forums/topic/listing-font-details/
$folder = "$env:windir\fonts\"
$objShell = New-Object -ComObject Shell.Application
$fileList = @()
$attrList = @{}
$details = @()
# $details = (
# "Title",
# "Font style",
# "Show/hide",
# "Designed for",
# "Category",
# "Designer/foundry" ,
# "Font Embeddability",
# "Font type",
# "Family",
# "Date created",
# "Date modified",
# "Collection",
# "Font file names",
# "Font version"
# )
# figure out what the possible metadata is
$objFolder = $objShell.namespace($folder)
for ($attr = 0; $attr -le 500; $attr++) {
$attrName = $objFolder.getDetailsOf($objFolder.items, $attr)
if ( $attrName -and ( -Not $attrList.Contains($attrName) )) {
$attrList.add( $attrName, $attr )
}
}
# $attrList
$details = $attrlist.GetEnumerator() | Select-Object -ExpandProperty Name
# loop through all the fonts, and process
$objFolder = $objShell.namespace($folder)
# $objFolderItems = $objFolder.Items() && $objFolderItems | Format-Table -AutoSize
# $itemCount = $objFolder.Items().Count
foreach ($file in $objFolder.items()) {
foreach ( $attr in $details) {
$attrValue = $objFolder.getDetailsOf($file, $attrList[$attr])
if ( $attrValue ) {
Add-Member -InputObject $file -MemberType NoteProperty -Name $attr -value $attrValue
}
}
$fileList += $file
write-verbose "Prcessing file number $($fileList.Count)..."
}
$fileList | Select-Object $details | out-gridview