Skip to content

Commit

Permalink
Merge pull request #24 from rstolpe/dev
Browse files Browse the repository at this point in the history
changed parameter
  • Loading branch information
rstolpe committed Jan 18, 2023
2 parents 1044828 + 74896ee commit 21941c8
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 40 deletions.
6 changes: 3 additions & 3 deletions .src/Public/Function/Uninstall-RSModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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

Expand Down
18 changes: 9 additions & 9 deletions .src/Public/Function/Update-RSModule.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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) {

Expand Down Expand Up @@ -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!"
}
Expand Down
2 changes: 1 addition & 1 deletion MaintainModule/MaintainModule.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
RootModule = '.\MaintainModule.psm1'

# Version number of this module.
ModuleVersion = '0.1.3'
ModuleVersion = '0.1.4'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
24 changes: 12 additions & 12 deletions MaintainModule/MaintainModule.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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) {

Expand Down Expand Up @@ -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!"
}
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.

Expand All @@ -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.

Expand All @@ -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.

Expand All @@ -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"```
The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel", "VMWare.PowerCLI"```
2 changes: 1 addition & 1 deletion RSModuleBuilder.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
6 changes: 3 additions & 3 deletions help/Uninstall-RSModule.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ SYNOPSIS


SYNTAX
Uninstall-RSModule [[-Module] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Uninstall-RSModule [[-Module] <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]


DESCRIPTION
This script let users uninstall older versions of the modules that are installed on the system.


PARAMETERS
-Module <String>
-Module <String[]>
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
Expand Down Expand Up @@ -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.


Expand Down
12 changes: 6 additions & 6 deletions help/Update-RSModule.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SYNOPSIS


SYNTAX
Update-RSModule [[-Module] <String>] [[-Scope] <String>] [-ImportModule] [-UninstallOldVersion] [-InstallMissing] [-WhatIf] [-Confirm] [<CommonParameters>]
Update-RSModule [[-Module] <String[]>] [[-Scope] <String>] [-ImportModule] [-UninstallOldVersion] [-InstallMissing] [-WhatIf] [-Confirm] [<CommonParameters>]


DESCRIPTION
Expand All @@ -16,7 +16,7 @@ DESCRIPTION


PARAMETERS
-Module <String>
-Module <String[]>
Specify the module or modules that you want to update, if you don't specify any module all installed modules are updated

Required? false
Expand Down Expand Up @@ -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


Expand All @@ -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.


Expand All @@ -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.


Expand All @@ -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.


Expand Down

0 comments on commit 21941c8

Please sign in to comment.