diff options
Diffstat (limited to '.config')
| -rw-r--r-- | .config/powershell/bloatware.ps1 | 10 | ||||
| -rw-r--r-- | .config/powershell/bootstrap.ps1 | 12 |
2 files changed, 21 insertions, 1 deletions
diff --git a/.config/powershell/bloatware.ps1 b/.config/powershell/bloatware.ps1 index 369079d..2c8dacb 100644 --- a/.config/powershell/bloatware.ps1 +++ b/.config/powershell/bloatware.ps1 @@ -1,5 +1,15 @@ # bloatware.ps1 +# Check if the powershell-yaml module is installed, if not, install it +if (-not (Get-Module powershell-yaml -ListAvailable)) { + $policy = Get-PSRepository -Name 'PSGallery' | Select-Object -ExpandProperty InstallationPolicy + Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted + Install-Module powershell-yaml + Set-PSRepository -Name 'PSGallery' -InstallationPolicy $policy +} + +Import-Module powershell-yaml + # Define the path to the YAML file $yamlFilePath = "$HOME\packages.yml" diff --git a/.config/powershell/bootstrap.ps1 b/.config/powershell/bootstrap.ps1 index 3d95afa..71d971f 100644 --- a/.config/powershell/bootstrap.ps1 +++ b/.config/powershell/bootstrap.ps1 @@ -45,7 +45,7 @@ Write-Host "Configuring PowerShell" Write-Host "----------------------------------------" # Get the "MyDocuments" path for the current user, excluding OneDrive -$UserMyDocumentsPath = [System.Environment]::GetFolderPath('MyDocuments').Replace("OneDrive", "") + "\Documents" +$UserMyDocumentsPath = [System.Environment]::GetFolderPath('MyDocuments').Replace("OneDrive", "") $PowerShellProfileDirectory = "$UserMyDocumentsPath\PowerShell" $PowerShellLegacySymlink = "$UserMyDocumentsPath\WindowsPowerShell" @@ -100,6 +100,16 @@ if (-not (Get-Command choco -ErrorAction SilentlyContinue)) { Write-Host "Installing Applications" Write-Host "----------------------------------------" +# Check if the powershell-yaml module is installed, if not, install it +if (-not (Get-Module powershell-yaml -ListAvailable)) { + $policy = Get-PSRepository -Name 'PSGallery' | Select-Object -ExpandProperty InstallationPolicy + Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted + Install-Module powershell-yaml + Set-PSRepository -Name 'PSGallery' -InstallationPolicy $policy +} + +Import-Module powershell-yaml + # Load packages.yml $packagesFile = "$HOME\packages.yml" $packages = Get-Content $packagesFile | ConvertFrom-Yaml |
