diff --git a/.src/Public/Function/Uninstall-RSModule.ps1 b/.src/Public/Function/Uninstall-RSModule.ps1 index 0dcd812..181fa08 100644 --- a/.src/Public/Function/Uninstall-RSModule.ps1 +++ b/.src/Public/Function/Uninstall-RSModule.ps1 @@ -14,7 +14,7 @@ # This will uninstall all older versions of the module VMWare.PowerCLI system. .EXAMPLE - Uninstall-RSModule -Module "VMWare.PowerCLI, ImportExcel" + Uninstall-RSModule -Module "VMWare.PowerCLI", "ImportExcel" # This will uninstall all older versions of VMWare.PowerCLI and ImportExcel from the system. .LINK @@ -33,7 +33,7 @@ [CmdletBinding(SupportsShouldProcess)] Param( [Parameter(Mandatory = $false, HelpMessage = "Enter the module or modules (separated with ,) you want to uninstall")] - [string]$Module + [string[]]$Module ) Write-Output "`n=== Starting to uninstall older versions of modules ===`n" @@ -64,7 +64,7 @@ } } - foreach ($m in $Module.Split()) { + foreach ($m in $Module) { Write-Verbose "Collecting all installed version of the module $($m)" $GetAllInstalledVersions = Get-InstalledModule -Name $m -AllVersions | Sort-Object { $_.Version -as [version] } -Descending | Select-Object -ExpandProperty Version diff --git a/.src/Public/Function/Update-RSModule.ps1 b/.src/Public/Function/Update-RSModule.ps1 index e3f0705..3d19f85 100644 --- a/.src/Public/Function/Update-RSModule.ps1 +++ b/.src/Public/Function/Update-RSModule.ps1 @@ -27,19 +27,19 @@ If you use this switch and the modules that are specified in the Module parameter are not installed on the system they will be installed. .EXAMPLE - Update-RSModule -Module "PowerCLI, ImportExcel" -Scope CurrentUser + Update-RSModule -Module "PowerCLI", "ImportExcel" -Scope CurrentUser # This will update the modules PowerCLI, ImportExcel for the current user .EXAMPLE - Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion + Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion # This will update the modules PowerCLI, ImportExcel and delete all of the old versions that are installed of PowerCLI, ImportExcel. .EXAMPLE - Update-RSModule -Module "PowerCLI, ImportExcel" -InstallMissing + Update-RSModule -Module "PowerCLI", "ImportExcel" -InstallMissing # This will install the modules PowerCLI and/or ImportExcel on the system if they are missing, if the modules are installed already they will only get updated. .EXAMPLE - Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion -ImportModule + Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion -ImportModule # This will update the modules PowerCLI and ImportExcel and delete all of the old versions that are installed of PowerCLI and ImportExcel and then import the modules. .LINK @@ -57,10 +57,10 @@ [CmdletBinding(SupportsShouldProcess)] Param( - [Parameter(Mandatory = $false, HelpMessage = "Enter module or modules (separated with ,) that you want to update, if you don't enter any all of the modules will be updated")] - [string]$Module, + [Parameter(Mandatory = $false, HelpMessage = "Enter module or modules that you want to update, if you don't enter any, all of the modules will be updated")] + [string[]]$Module, + [Parameter(Mandatory = $false, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules, default is CurrentUser")] [ValidateSet("CurrentUser", "AllUsers")] - [Parameter(Mandatory = $false, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules")] [string]$Scope = "CurrentUser", [Parameter(Mandatory = $false, HelpMessage = "Import modules that has been entered in the module parameter at the end of this function")] [switch]$ImportModule = $false, @@ -125,7 +125,7 @@ # Start looping trough every module that are stored in the string Module - foreach ($m in $Module.Split()) { + foreach ($m in $Module) { Write-Verbose "Checks if $($m) are installed" if ($m -in $InstalledModules.Name) { @@ -188,7 +188,7 @@ # Import module if it's not imported Write-Verbose "Starting to import the modules..." - foreach ($m in $Module.Split()) { + foreach ($m in $Module) { if ($m -in $ImportedModules.Name) { Write-Verbose "$($m) are already imported!" } diff --git a/MaintainModule/MaintainModule.psd1 b/MaintainModule/MaintainModule.psd1 index cb1b90b..90364ca 100644 --- a/MaintainModule/MaintainModule.psd1 +++ b/MaintainModule/MaintainModule.psd1 @@ -36,7 +36,7 @@ RootModule = '.\MaintainModule.psm1' # Version number of this module. - ModuleVersion = '0.1.3' + ModuleVersion = '0.1.4' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/MaintainModule/MaintainModule.psm1 b/MaintainModule/MaintainModule.psm1 index 7348e00..0dad3ea 100644 --- a/MaintainModule/MaintainModule.psm1 +++ b/MaintainModule/MaintainModule.psm1 @@ -37,7 +37,7 @@ Function Uninstall-RSModule { # This will uninstall all older versions of the module VMWare.PowerCLI system. .EXAMPLE - Uninstall-RSModule -Module "VMWare.PowerCLI, ImportExcel" + Uninstall-RSModule -Module "VMWare.PowerCLI", "ImportExcel" # This will uninstall all older versions of VMWare.PowerCLI and ImportExcel from the system. .LINK @@ -56,7 +56,7 @@ Function Uninstall-RSModule { [CmdletBinding(SupportsShouldProcess)] Param( [Parameter(Mandatory = $false, HelpMessage = "Enter the module or modules (separated with ,) you want to uninstall")] - [string]$Module + [string[]]$Module ) Write-Output "`n=== Starting to uninstall older versions of modules ===`n" @@ -87,7 +87,7 @@ Function Uninstall-RSModule { } } - foreach ($m in $Module.Split()) { + foreach ($m in $Module) { Write-Verbose "Collecting all installed version of the module $($m)" $GetAllInstalledVersions = Get-InstalledModule -Name $m -AllVersions | Sort-Object { $_.Version -as [version] } -Descending | Select-Object -ExpandProperty Version @@ -144,19 +144,19 @@ Function Update-RSModule { If you use this switch and the modules that are specified in the Module parameter are not installed on the system they will be installed. .EXAMPLE - Update-RSModule -Module "PowerCLI, ImportExcel" -Scope CurrentUser + Update-RSModule -Module "PowerCLI", "ImportExcel" -Scope CurrentUser # This will update the modules PowerCLI, ImportExcel for the current user .EXAMPLE - Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion + Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion # This will update the modules PowerCLI, ImportExcel and delete all of the old versions that are installed of PowerCLI, ImportExcel. .EXAMPLE - Update-RSModule -Module "PowerCLI, ImportExcel" -InstallMissing + Update-RSModule -Module "PowerCLI", "ImportExcel" -InstallMissing # This will install the modules PowerCLI and/or ImportExcel on the system if they are missing, if the modules are installed already they will only get updated. .EXAMPLE - Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion -ImportModule + Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion -ImportModule # This will update the modules PowerCLI and ImportExcel and delete all of the old versions that are installed of PowerCLI and ImportExcel and then import the modules. .LINK @@ -174,10 +174,10 @@ Function Update-RSModule { [CmdletBinding(SupportsShouldProcess)] Param( - [Parameter(Mandatory = $false, HelpMessage = "Enter module or modules (separated with ,) that you want to update, if you don't enter any all of the modules will be updated")] - [string]$Module, + [Parameter(Mandatory = $false, HelpMessage = "Enter module or modules that you want to update, if you don't enter any, all of the modules will be updated")] + [string[]]$Module, + [Parameter(Mandatory = $false, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules, default is CurrentUser")] [ValidateSet("CurrentUser", "AllUsers")] - [Parameter(Mandatory = $false, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules")] [string]$Scope = "CurrentUser", [Parameter(Mandatory = $false, HelpMessage = "Import modules that has been entered in the module parameter at the end of this function")] [switch]$ImportModule = $false, @@ -242,7 +242,7 @@ Function Update-RSModule { # Start looping trough every module that are stored in the string Module - foreach ($m in $Module.Split()) { + foreach ($m in $Module) { Write-Verbose "Checks if $($m) are installed" if ($m -in $InstalledModules.Name) { @@ -305,7 +305,7 @@ Function Update-RSModule { # Import module if it's not imported Write-Verbose "Starting to import the modules..." - foreach ($m in $Module.Split()) { + foreach ($m in $Module) { if ($m -in $ImportedModules.Name) { Write-Verbose "$($m) are already imported!" } diff --git a/README.md b/README.md index 0ea7d25..08cb389 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ If you want you can update specific modules, you can do that with the following ```` Update-RSModule -Module "VMWare.PowerCLI" ```` -The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel, VMWare.PowerCLI"``` +The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel", "VMWare.PowerCLI"``` You can also use the -Scope parameter if you want to change from CurrentUser to AllUsers, for example ```-Scope "AllUser"``` If -Scope parameter are empty it will set it as CurrentUser as default. @@ -75,7 +75,7 @@ If you want to uninstall old versions of only a specific module you can run ```` Update-RSModule -Module "ImportExcel" -UninstallOldVersion ```` -The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel, VMWare.PowerCLI"``` +The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel", "VMWare.PowerCLI"``` You can also use the -Scope parameter if you want to change from CurrentUser to AllUsers, for example ```-Scope "AllUser"``` If -Scope parameter are empty it will set it as CurrentUser as default. @@ -85,7 +85,7 @@ If the module are installed already this will not have any effect and the module ```` Update-RSModule -Module "VMWare.PowerCLI" -InstallMissing ```` -The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel, VMWare.PowerCLI"``` +The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel", "VMWare.PowerCLI"``` You can also use the -Scope parameter if you want to change from CurrentUser to AllUsers, for example ```-Scope "AllUser"``` If -Scope parameter are empty it will set it as CurrentUser as default. @@ -94,7 +94,7 @@ You can choose to import all of the modules at the end of the script, this only ```` Update-RSModule -Module "VMWare.PowerCLI" -ImportModule ```` -The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel, VMWare.PowerCLI"``` +The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel", "VMWare.PowerCLI"``` You can also use the -Scope parameter if you want to change from CurrentUser to AllUsers, for example ```-Scope "AllUser"``` If -Scope parameter are empty it will set it as CurrentUser as default. @@ -111,4 +111,4 @@ If you want to uninstall all older version of a specific module ```` Uninstall-RSModule -Module "ImportExcel" ```` -The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel, VMWare.PowerCLI"``` \ No newline at end of file +The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel", "VMWare.PowerCLI"``` \ No newline at end of file diff --git a/RSModuleBuilder.ps1 b/RSModuleBuilder.ps1 index 7892de9..5325e7e 100644 --- a/RSModuleBuilder.ps1 +++ b/RSModuleBuilder.ps1 @@ -9,7 +9,7 @@ [string]$apiKey = "" # # Changes on every build -[string]$Version = "0.1.3" +[string]$Version = "0.1.4" [string]$PowerShellVersion = "5.1" [string]$Tags = '"PowerShell", "macOS", "Windows", "Linux", "support-tool", "sysadmin-tool", "it-tool", "maintain-module", "module-maintenance", "multi-platform", "multiOS"' [string]$ProcessorArchitecture = "" diff --git a/help/Uninstall-RSModule.md b/help/Uninstall-RSModule.md index 3bbc450..9597898 100644 --- a/help/Uninstall-RSModule.md +++ b/help/Uninstall-RSModule.md @@ -7,7 +7,7 @@ SYNOPSIS SYNTAX - Uninstall-RSModule [[-Module] ] [-WhatIf] [-Confirm] [] + Uninstall-RSModule [[-Module] ] [-WhatIf] [-Confirm] [] DESCRIPTION @@ -15,7 +15,7 @@ DESCRIPTION PARAMETERS - -Module + -Module Specify modules that you want to uninstall older versions from, if this is left empty all of the older versions of the systems modules will be uninstalled Required? false @@ -73,7 +73,7 @@ NOTES -------------------------- EXAMPLE 2 -------------------------- - PS > Uninstall-RSModule -Module "VMWare.PowerCLI, ImportExcel" + PS > Uninstall-RSModule -Module "VMWare.PowerCLI", "ImportExcel" # This will uninstall all older versions of VMWare.PowerCLI and ImportExcel from the system. diff --git a/help/Update-RSModule.md b/help/Update-RSModule.md index c71048d..9be0f9e 100644 --- a/help/Update-RSModule.md +++ b/help/Update-RSModule.md @@ -7,7 +7,7 @@ SYNOPSIS SYNTAX - Update-RSModule [[-Module] ] [[-Scope] ] [-ImportModule] [-UninstallOldVersion] [-InstallMissing] [-WhatIf] [-Confirm] [] + Update-RSModule [[-Module] ] [[-Scope] ] [-ImportModule] [-UninstallOldVersion] [-InstallMissing] [-WhatIf] [-Confirm] [] DESCRIPTION @@ -16,7 +16,7 @@ DESCRIPTION PARAMETERS - -Module + -Module Specify the module or modules that you want to update, if you don't specify any module all installed modules are updated Required? false @@ -104,7 +104,7 @@ NOTES -------------------------- EXAMPLE 1 -------------------------- - PS > Update-RSModule -Module "PowerCLI, ImportExcel" -Scope CurrentUser + PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -Scope CurrentUser # This will update the modules PowerCLI, ImportExcel for the current user @@ -114,7 +114,7 @@ NOTES -------------------------- EXAMPLE 2 -------------------------- - PS > Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion + PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion # This will update the modules PowerCLI, ImportExcel and delete all of the old versions that are installed of PowerCLI, ImportExcel. @@ -124,7 +124,7 @@ NOTES -------------------------- EXAMPLE 3 -------------------------- - PS > Update-RSModule -Module "PowerCLI, ImportExcel" -InstallMissing + PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -InstallMissing # This will install the modules PowerCLI and/or ImportExcel on the system if they are missing, if the modules are installed already they will only get updated. @@ -134,7 +134,7 @@ NOTES -------------------------- EXAMPLE 4 -------------------------- - PS > Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion -ImportModule + PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion -ImportModule # This will update the modules PowerCLI and ImportExcel and delete all of the old versions that are installed of PowerCLI and ImportExcel and then import the modules.