Allow skipping powershell module registration
This commit is contained in:
parent
bb989ccc9b
commit
fcc0529c1b
1 changed files with 15 additions and 6 deletions
|
@ -9,11 +9,18 @@ $null = New-Module {
|
||||||
|
|
||||||
.PARAMETER Name
|
.PARAMETER Name
|
||||||
The name of the module to install.
|
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 {
|
function Get-ModuleInstallerComponents {
|
||||||
param(
|
param(
|
||||||
[string] $Name,
|
[string] $Name,
|
||||||
[switch] $NativeOnly
|
[switch] $NativeOnly,
|
||||||
|
[switch] $NoProfile
|
||||||
)
|
)
|
||||||
|
|
||||||
@{
|
@{
|
||||||
|
@ -47,12 +54,14 @@ $null = New-Module {
|
||||||
[hashtable] $Arguments
|
[hashtable] $Arguments
|
||||||
)
|
)
|
||||||
|
|
||||||
$name = $Arguments.Name;
|
if (-not $NoProfile) {
|
||||||
|
$name = $Arguments.Name;
|
||||||
|
|
||||||
Add-PowerShellProfileStatement `
|
Add-PowerShellProfileStatement `
|
||||||
-DefaultUser `
|
-DefaultUser `
|
||||||
-Category $name `
|
-Category $name `
|
||||||
-Script "Import-Module `"$name`";";
|
-Script "Import-Module `"$name`";";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue