From b44c8833b524942a63f3ea1cb679581a73aefc9c Mon Sep 17 00:00:00 2001
From: Manuel Thalmann <m@nuth.ch>
Date: Thu, 27 Jul 2023 01:59:03 +0200
Subject: [PATCH] Add ability to load PowerShell profile files

---
 scripts/Windows/Config/PowerShell/Install.ps1 | 8 ++++++++
 scripts/Windows/OS/Install.ps1                | 1 +
 2 files changed, 9 insertions(+)
 create mode 100644 scripts/Windows/Config/PowerShell/Install.ps1

diff --git a/scripts/Windows/Config/PowerShell/Install.ps1 b/scripts/Windows/Config/PowerShell/Install.ps1
new file mode 100644
index 00000000..33a7f417
--- /dev/null
+++ b/scripts/Windows/Config/PowerShell/Install.ps1
@@ -0,0 +1,8 @@
+#!/bin/pwsh
+param($context)
+. "$PSScriptRoot/../../Scripts/Context.ps1";
+
+Write-Host "Configuring PowerShell";
+Write-Information "Allow addition of any number of profile files";
+[Context] $context = $context;
+$context.AddPowerShellProfileStatement('. "$PSScriptRoot/profile.d/*.ps1";');
diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1
index bae56733..d5d3a732 100644
--- a/scripts/Windows/OS/Install.ps1
+++ b/scripts/Windows/OS/Install.ps1
@@ -18,6 +18,7 @@ function Invoke-WindowsInstallation([Context] $context)
         . "$configPath/Explorer/Install.ps1" $context;
         . "$configPath/OpenSSH/Install.ps1" $context;
         . "$configPath/chocolatey/Install.ps1";
+        . "$configPath/PowerShell/Install.ps1" $context;
 
         $context.RemoveDesktopIcon("*Microsoft Edge*");
         $context.Set("InitialConfiguration", 1, "DWord");