Install fonts with PowerShell

The function Install-Font lets you install fonts using PowerShell. It triggers the Install for all users command, utilizing a technique demonstrated by Stefan Kanthak:

function Install-Font {
	
	[CmdletBinding()]
	param(
		[Parameter(Mandatory, ValueFromPipeline)]
		[System.IO.FileInfo]
		$FontFile
	)
	
	begin {
		$shell = New-Object -ComObject 'Shell.Application';
	}
	
	process {
		Write-Host -Message(
			'Installing font "{0}".' -f $_.Name
		);
		$shell.NameSpace(
			$_.Directory.FullName
		).ParseName(
			$_.Name
		).Verbs() | ForEach-Object {
			if( $_.Name -eq 'Install for &all users' ) {
				$_.DoIt();
			}
		};
	}
}
Install-Font.ps1

Use this function as follows:

PS C:\> Get-ChildItem -LiteralPath "$env:USERPROFILE\Downloads" -File -Filter *.ttf | Install-Font