Skip to content

Install-Font

SYNOPSIS

Installs a font in the system.

SYNTAX

Install-Font [-Path] <String[]> [[-Scope] <String[]>] [-Recurse] [-Force] [-ProgressAction <ActionPreference>]
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Installs a font in the system, either for the current user or all users, depending on the specified scope. If the font is already installed, it can be optionally overwritten using the -Force parameter. The function supports both single file installations and batch installations via pipeline input.

Installing fonts for all users requires administrator privileges.

EXAMPLES

EXAMPLE 1

Install-Font -Path C:\FontFiles\Arial.ttf

Output:

Arial.ttf installed for the current user.

Installs the font file Arial.ttf for the current user.

EXAMPLE 2

Install-Font -Path C:\FontFiles\Arial.ttf -Scope AllUsers

Output:

Arial.ttf installed for all users.

Installs the font file Arial.ttf system-wide, making it available to all users. This requires administrator rights.

EXAMPLE 3

Install-Font -Path C:\FontFiles\Arial.ttf -Force

Output:

Arial.ttf reinstalled for the current user.

Installs the font file Arial.ttf for the current user. If it already exists, it will be overwritten.

EXAMPLE 4

Install-Font -Path C:\FontFiles\Arial.ttf -Scope AllUsers -Force

Output:

Arial.ttf reinstalled for all users.

Installs the font file Arial.ttf system-wide and overwrites the existing font if present.

EXAMPLE 5

Get-ChildItem -Path C:\FontFiles\ -Filter *.ttf | Install-Font

Output:

Found 3 font files.
Arial.ttf installed for the current user.
Verdana.ttf installed for the current user.
TimesNewRoman.ttf installed for the current user.

Installs all .ttf font files found in C:\FontFiles\ for the current user.

EXAMPLE 6

Get-ChildItem -Path C:\FontFiles\ -Filter *.ttf | Install-Font -Scope AllUsers

Output:

Found 3 font files.
Arial.ttf installed for all users.
Verdana.ttf installed for all users.
TimesNewRoman.ttf installed for all users.

Installs all .ttf font files found in C:\FontFiles\ system-wide. This requires administrator rights.

EXAMPLE 7

Get-ChildItem -Path C:\FontFiles\ -Filter *.ttf | Install-Font -Scope AllUsers -Force

Output:

Found 3 font files.
Arial.ttf reinstalled for all users.
Verdana.ttf reinstalled for all users.
TimesNewRoman.ttf reinstalled for all users.

Installs all .ttf font files found in C:\FontFiles\ system-wide, overwriting existing fonts. This requires administrator rights.

PARAMETERS

-Path

File or folder path(s) to the font(s) to install.

Type: String[]
Parameter Sets: (All)
Aliases: FullName

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-Scope

Scope of the font installation. CurrentUser will install the font for the current user only. AllUsers will install the font so it is available for all users on the system.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: CurrentUser
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Recurse

Recurse will install all fonts in the specified folder and subfolders.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Force

Force will overwrite existing fonts.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.String

NOTES

Returns messages indicating success or failure of font installation.

https://psmodule.io/Admin/Functions/Install-Font/