-
Notifications
You must be signed in to change notification settings - Fork 0
/
Install-Fonts.ps1
46 lines (37 loc) · 1.63 KB
/
Install-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
<#
.SYNOPSIS
Installs all fonts from a directory
.DESCRIPTION
Installs all fonts from a directory
.PARAMETER FontsSourcePath
The path to an individual font to install, or a directory containing fonts to install.
.EXAMPLE
Install-Fonts -Path "$env:Temp\Fonts_to_install"
Installs all fonts from the "$env:Temp\Fonts_to_install" directory. Fonts will be installed system-wide.
.LINK
https://github.com/gabriel-vanca/PowerShell_Library/blob/main/Scripts/Core/Fonts/Install-Fonts.ps1
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $True)] [ValidateNotNullOrEmpty()] [String]$FontsSourcePath
)
#Requires -RunAsAdministrator
# ($NULL -eq $IsWindows) checks for Windows Sandbox enviroment
if($IsWindows -or ($NULL -eq $IsWindows)) {
Write-Host "Windows deployment detected."
$scriptPath = "https://raw.githubusercontent.com/gabriel-vanca/PowerShell_Library/main/Scripts/Windows/Fonts/Install-Fonts.ps1"
} else {
if($IsLinux) {
Write-Host "Linux deployment detected."
$scriptPath = "https://raw.githubusercontent.com/gabriel-vanca/PowerShell_Library/main/Scripts/Linux/Fonts/Install-Fonts.ps1"
} else {
if($IsMacOS) {
Write-Host "MacOS deployment detected."
$scriptPath = "https://raw.githubusercontent.com/gabriel-vanca/PowerShell_Library/main/Scripts/MacOS/Fonts/Install-Fonts.ps1"
}
}
}
$WebClient = New-Object Net.WebClient
$deploymentScript = $WebClient.DownloadString($scriptPath)
$deploymentScript = [Scriptblock]::Create($deploymentScript)
Invoke-Command -ScriptBlock $deploymentScript -ArgumentList ($FontsSourcePath) -NoNewScope