Housekeeping;Add prereq module installation
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Danny Bessems 2021-06-24 10:14:22 +02:00
parent 16575d1db4
commit 567e7e64f9
4 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,40 @@
[CmdletBinding()]
Param(
# No parameters
)
$RequiredPSModules = @(
'ntobjectmanager' # Provides cmdlet 'Set-ExecutionAlias'
)
$InstallPackageProviderSplat = @{
Name = 'NuGet'
MinimumVersion = '2.8.5.201'
Force = $True
Confirm = $False
}
Install-PackageProvider @InstallPackageProviderSplat
$SetPSRepositorySplat = @{
Name = 'PSGallery'
InstallationPolicy = 'Trusted'
}
Set-PSRepository @SetPSRepositorySplat
$InstallModuleSplat = @{
Name = $RequiredPSModules
Force = $True
Confirm = $False
}
Install-Module @InstallModuleSplat
$SetPSRepositorySplat = @{
Name = 'PSGallery'
InstallationPolicy = 'Untrusted'
}
Set-PSRepository @SetPSRepositorySplat
# Double check whether the required PowerShell modules are available
ForEach ($Module in $RequiredPSModules) {
If ([boolean](Get-Module -Name $Module -ListAvailable) -ne $True) {
Write-Error -Message "Missing PowerShell module '$($Module)'"
Exit 1
}
}

View File

@ -1,3 +1,4 @@
#Requires -Modules 'NtObjectManager'
[CmdletBinding()] [CmdletBinding()]
Param( Param(
# None # None