-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-powershell.ps1
More file actions
39 lines (28 loc) · 1.56 KB
/
setup-powershell.ps1
File metadata and controls
39 lines (28 loc) · 1.56 KB
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
$currentUser = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
$isAdmin = $currentUser.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Warning "This script is not running with administrative privileges."
Exit 1
}
# REF: https://docs.microsoft.com/fr-fr/powershell/scripting/gallery/installing-psget?view=powershell-7.2
Install-PackageProvider -Name NuGet -Force
Install-Module PowerShellGet -AllowClobber -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
# REF: https://github.com/PowerShell/PSReadLine
Install-Module -Name PowerShellGet -Force
Uninstall-Module PSReadLine -AllVersions
Install-Module PSReadLine -Force
# REF: https://ohmyposh.dev/docs/migrating
Remove-Item $env:POSH_PATH -Force -Recurse
Uninstall-Module oh-my-posh -AllVersions
# Delete the import of the PowerShell module in your $PROFILE
# No need to delete since it's going to replace it with this folder profile config
# REF: https://ohmyposh.dev/docs/installation/windows
winget install JanDeDobbeleer.OhMyPosh -s winget
$psPath = [Environment]::GetFolderPath("MyDocuments") + "\WindowsPowerShell"
Copy-Item $psPath"\Microsoft.PowerShell_profile.ps1" -Destination $psPath"\Microsoft.PowerShell_profile.bkp.ps1"
Copy-Item "./Microsoft.PowerShell_profile.ps1" -Destination $psPath
Copy-Item "./froczh.omp.json" -Destination $env:POSH_THEMES_PATH
#https://ohmyposh.dev/docs/installation/fonts
oh-my-posh font install Meslo
# ToDo change VS Code Integrated terminal font and Windows terminal font