More changes to make platform-agnostic
This commit is contained in:
@@ -218,6 +218,61 @@ Function Initialize-PSGallery {
|
||||
}
|
||||
}
|
||||
|
||||
Import-Modules {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
A brief description of the function or script.
|
||||
|
||||
.DESCRIPTION
|
||||
A longer description.
|
||||
|
||||
.PARAMETER FirstParameter
|
||||
Description of each of the parameters.
|
||||
Note:
|
||||
To make it easier to keep the comments synchronized with changes to the parameters,
|
||||
the preferred location for parameter documentation comments is not here,
|
||||
but within the param block, directly above each parameter.
|
||||
|
||||
.PARAMETER SecondParameter
|
||||
Description of each of the parameters.
|
||||
|
||||
.INPUTS
|
||||
Description of objects that can be piped to the script.
|
||||
|
||||
.OUTPUTS
|
||||
Description of objects that are output by the script.
|
||||
|
||||
.EXAMPLE
|
||||
Example of how to run the script.
|
||||
|
||||
.LINK
|
||||
Links to further documentation.
|
||||
|
||||
.NOTES
|
||||
Detail on what the script does, if this is needed.
|
||||
|
||||
#>
|
||||
Param (
|
||||
[Parameter(Mandatory=$true)] $ModuleList
|
||||
)
|
||||
If ($ModuleList) {
|
||||
Initialize-PSGallery
|
||||
ForEach ($Module in $ModuleList) {
|
||||
If (-Not (Get-Module -ListAvailable -Name $Module)) {
|
||||
Try {
|
||||
Add-LogEntry "Module `"$Module`" not found, installing"
|
||||
Install-Module -Name $Module -Scope CurrentUser -Force -AllowClobber
|
||||
}
|
||||
Catch {
|
||||
Add-LogEntry "Module failed to install automatically! Manaully install the module, then re-run the script." -As Error
|
||||
Exit 1
|
||||
}
|
||||
}
|
||||
Import-Module $Module
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Function Import-JSONConfig () {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
Reference in New Issue
Block a user