Allow skipping powershell module registration

This commit is contained in:
Manuel Thalmann 2024-08-22 23:55:00 +02:00
parent 3c4f794d0a
commit b2f5dd6fc1

View file

@ -8,11 +8,18 @@ $null = New-Module {
.PARAMETER Name
The name of the module to install.
.PARAMETER NativeOnly
A value indicating whether the module is installed in Windows PowerShell only.
.PARAMETER NoProfile
A value indicating whether the module is not added to the profile script of users.
#>
function Get-ModuleInstallerComponents {
param(
[string] $Name,
[switch] $NativeOnly
[switch] $NativeOnly,
[switch] $NoProfile
)
@{
@ -46,12 +53,14 @@ $null = New-Module {
[hashtable] $Arguments
)
if (-not $NoProfile) {
$name = $Arguments.Name;
Add-PowerShellProfileStatement `
-DefaultUser `
-Category $name `
-Script "Import-Module `"$name`";";
}
};
}
}