-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGet-Font.ps1
More file actions
32 lines (29 loc) · 776 Bytes
/
Get-Font.ps1
File metadata and controls
32 lines (29 loc) · 776 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
30
31
32
param
(
[Parameter(Mandatory=$false, ValueFromPipeline=$false, ValueFromPipelineByPropertyName=$false)]
[string] $Name,
[Parameter(Mandatory=$false, ValueFromPipeline=$false, ValueFromPipelineByPropertyName=$false)]
[string] $Path
)
[int] ${namespace} = 0x14
try
{
${shell} = New-Object -ComObject "Shell.Application"
${fontNamespace} = ${shell}.Namespace(${namespace})
${fontNamespace}.Items() | ForEach-Object -Process {
[pscustomobject] @{
Name = $_.Name
Path = $_.Path
}
} | Where-Object -FilterScript {
$_.Name -ilike "*${Name}*" -and $_.Path -ilike "*${Path}*"
}
}
catch
{
throw
}
finally
{
[System.Runtime.InteropServices.Marshal]::ReleaseComObject(${shell}) | Out-Null
}