Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 73a534c

Browse files
author
Robin Stolpe
committed
update
1 parent b6c6a81 commit 73a534c

1 file changed

Lines changed: 0 additions & 31 deletions

File tree

MaintainModule/MaintainModule.psm1

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,6 @@ Function Update-rsModule {
195195
The parameter -Scope don't effect the uninstall-module function this is because of limitation from Microsoft.
196196
- Scope effect Install/update module function.
197197
198-
.PARAMETER ImportModule
199-
If this switch are used the module will import all the modules that are specified in the Module parameter at the end of the script.
200-
This only works if you have specified modules in the Module parameter
201-
202198
.PARAMETER UninstallOldVersion
203199
If this switch are used all of the old versions of your modules will get uninstalled and only the current version will be installed
204200
@@ -241,8 +237,6 @@ Function Update-rsModule {
241237
[Parameter(Mandatory = $false, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules, default is CurrentUser")]
242238
[ValidateSet("CurrentUser", "AllUsers")]
243239
[string]$Scope = "CurrentUser",
244-
[Parameter(Mandatory = $false, HelpMessage = "Import modules that has been entered in the module parameter at the end of this function")]
245-
[switch]$ImportModule = $false,
246240
[Parameter(Mandatory = $false, HelpMessage = "Uninstalls all old versions of the modules")]
247241
[switch]$UninstallOldVersion = $false,
248242
[Parameter(Mandatory = $false, HelpMessage = "Install all of the modules that has been entered in module that are not installed on the system")]
@@ -319,31 +313,6 @@ Function Update-rsModule {
319313
Write-Verbose "$($_module.name) are not installed, you have not chosen to install missing modules"
320314
}
321315
}
322-
323-
if ($ImportModule -eq $true) {
324-
# Collect all of the imported modules.
325-
Write-Verbose "Collecting all of the installed modules..."
326-
$ImportedModules = Get-Module | Select-Object Name, Version
327-
328-
# Import module if it's not imported
329-
Write-Verbose "Starting to import the modules..."
330-
foreach ($_module in $Module) {
331-
if ($_module -in $ImportedModules.Name) {
332-
Write-Verbose "$($_module) are already imported!"
333-
}
334-
else {
335-
try {
336-
Write-Output "Importing $($_module)..."
337-
Import-Module -Name $_module -Force
338-
Write-Output "$($_module) has been imported!"
339-
}
340-
catch {
341-
Write-Error "$($PSItem.Exception)"
342-
continue
343-
}
344-
}
345-
}
346-
}
347316

348317
Write-Output "`n=== \\\ Script Finished! /// ===`n"
349318
}

0 commit comments

Comments
 (0)