aboutsummaryrefslogtreecommitdiff
path: root/src/powershell/install.sh
diff options
context:
space:
mode:
authorRoss Smith <ross-p-smith@users.noreply.github.com>2023-01-30 22:29:13 +0300
committerGitHub <noreply@github.com>2023-01-30 22:29:13 +0300
commit7763e0b7db6a16f2efececb6ffa9bd917a9eb5de (patch)
tree1a31f1916744b6e40d9a741838aa29a584f666f8 /src/powershell/install.sh
parentfbdc4556d519512736a8e2abfb3e03fcb2c9e0c7 (diff)
Install PowerShell Modules (#427)feature_powershell_1.1.0
* InstallBicep * Add test for InstallBicep * Install pwsh Modules * Script rename * Add -Command to test * Check version * Install the module for all users * Adding terminating lines to scripts * Update src/powershell/install.sh Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com> * Update src/powershell/install.sh Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com> * Removed comments in Readme * Remove Bicep from PowerShell install * Increased version number * Update Minor version rather than patch --------- Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
Diffstat (limited to 'src/powershell/install.sh')
-rwxr-xr-xsrc/powershell/install.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/powershell/install.sh b/src/powershell/install.sh
index 3f19f47..b220c3a 100755
--- a/src/powershell/install.sh
+++ b/src/powershell/install.sh
@@ -13,6 +13,7 @@ set -e
rm -rf /var/lib/apt/lists/*
POWERSHELL_VERSION=${VERSION:-"latest"}
+POWERSHELL_MODULES="${MODULES}"
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
POWERSHELL_ARCHIVE_ARCHITECTURES="amd64"
@@ -149,6 +150,17 @@ if [ "${use_github}" = "true" ]; then
install_using_github
fi
+# If PowerShell modules are requested, loop through and install
+if [ ${#POWERSHELL_MODULES[@]} -gt 0 ]; then
+ echo "Installing PowerShell Modules: ${POWERSHELL_MODULES}"
+ modules=(`echo ${POWERSHELL_MODULES} | tr ',' ' '`)
+ for i in "${modules[@]}"
+ do
+ echo "Installing ${i}"
+ pwsh -Command "Install-Module -Name ${i} -AllowClobber -Force -Scope AllUsers" || continue
+ done
+fi
+
# Clean up
rm -rf /var/lib/apt/lists/*